Skip to content

fix(dav): keep the latest FilePicker destination - #2611

Open
Daddyoftwins1 wants to merge 1 commit into
nextcloud-libraries:mainfrom
Daddyoftwins1:fix/file-picker-stale-navigation-response
Open

Daddyoftwins1 wants to merge 1 commit into
nextcloud-libraries:mainfrom
Daddyoftwins1:fix/file-picker-stale-navigation-response

Conversation

@Daddyoftwins1

Copy link
Copy Markdown

Problem

While moving a folder in Nextcloud, I selected Photos as the destination, but the picker returned the folder I was already in and displayed the message that the folder was already in that directory.

The problem can happen when directory requests finish out of order. Opening another folder starts a newer DAV listing request, but cancellation does not guarantee that the older request stops immediately. If the older response finishes later, it can replace the active folder information even though the path and button still show the newer destination.

This leaves the displayed destination and the folder returned by the picker out of sync.

Changes

This change:

  • ensures that only the latest DAV listing request can update the current folder, file list and loading state
  • prevents an older response from replacing a newer destination
  • clears stale destination information while a replacement folder is loading or when its request fails
  • prevents directory confirmation until the loaded folder matches the path displayed by the picker
  • adds regression tests for delayed responses, cancellation ordering, failed requests, view changes and destination confirmation

Related to #2511, which covers the same race-condition area.

Testing

The following focused checks passed:

  • 8 Vitest tests covering the changed DAV and FilePicker behavior
  • ESLint on all four changed files
  • git diff --check

The complete repository test suite, a production build and fresh live-instance testing were not performed for this contribution branch.

AI assistance

Development and automated testing of this contribution were assisted by OpenAI Codex using GPT-5.

Assisted-by: OpenAI Codex:GPT-5
Signed-off-by: Josh Duffy <118084832+Daddyoftwins1@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant