Fix file browser opening race condition #23867
Merged
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.
For #23832
This dialog is set up so that when the filter option is changed it fires an event to tell the provider to refresh the tree. But STS expects that this only happens AFTER the initial open event is sent so it initializes properly. And there was a race condition here where the select box event firing could happen before this initial event was actually completed.
So to fix this we send the initialize event before actually setting the filter box contents - this ensures the message is sent before we get the filter notification.
A slightly better solution would probably be to refactor this to be completely async and keep track of whether the initialize event has been sent before sending the filter event - but that's beyond the scope of the fix for July so just going with the simpler fix for now.
Note - it's unclear why this only seems to be showing up now. I didn't see any changes that would explain this. But race conditions are weird like that - so maybe a node update or something changed things enough that this would show up more often.