Avoid stale simple dialog folder updates#321357
Merged
alexr00 merged 3 commits intoJul 14, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR prevents a slow/canceled updateItems call in SimpleFileDialog from overwriting the state produced by a newer folder update, and adds a regression test to lock in the behavior.
Changes:
- Delay committing
currentFolder/userEnteredPathSegmentuntil after cancellation is checked. - Use a stable folder reference (
currFolder) when computing parent/root behavior. - Add a browser test to ensure canceled slow updates don’t override newer updates.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/vs/workbench/services/dialogs/test/browser/simpleFileDialog.test.ts | Adds a regression test covering the “slow canceled update must not overwrite newer folder” scenario |
| src/vs/workbench/services/dialogs/browser/simpleFileDialog.ts | Defers state assignment until after cancellation and uses a stable folder reference to avoid racey overwrites |
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @alexr00Matched files:
|
Contributor
Author
|
@microsoft-github-policy-service agree |
alexr00
approved these changes
Jul 14, 2026
alexr00
enabled auto-merge (squash)
July 14, 2026 10:14
dbaeumer
approved these changes
Jul 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #152089
This fixes a race in the simple file dialog when a slower folder update is canceled by a newer one. Previously, the canceled update could still resume after
fileService.resolveand writecurrentFolder/userEnteredPathSegmentbefore checking the cancellation token. That stale state could then affect subsequent input handling on slow file system providers.The update now computes the next folder state locally and only commits it after item creation finishes and the token is still active.
createBackItemalso uses the folder passed intocreateItemsinstead of readingthis.currentFolder, so the current folder does not need to be mutated before the async item work completes.Verification:
PATH="/opt/homebrew/opt/node@24/bin:$PATH" npm run compile-clientfile:///slow/ === file:///fast/, then passed after the fixPATH="/opt/homebrew/opt/node@24/bin:$PATH" npm run test-browser-no-install -- --run src/vs/workbench/services/dialogs/test/browser/simpleFileDialog.test.ts --browser chromium-chromegit diff --check