Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where dropdown buttons for launching project host pointed to stale projects #2930

Merged
merged 1 commit into from
May 15, 2024

Conversation

adrastogi
Copy link
Contributor

@adrastogi adrastogi commented May 15, 2024

Summary of the pull request

This change fixes a bug in scenarios where, when a user has multiple project hosts installed (Visual Studio Code and Visual Studio Code Insiders in the case of our implementation), the launch buttons would not open the most-recently-generated project and instead always attempt to open the first one.

References and relevant issues

#2917

Detailed description of the pull request / Additional comments

If an extension supports multiple project hosts, Quickstart Playground shows a DropdownButton for allowing the user to choose which of those hosts they would like to use for launching their generated project. We noticed that if a user happens to have multiple project hosts installed, then on the second and onward generation attempt in the same session, the launch buttons would not open the most recently generated project. Rather, they would attempt to open the very first project (which would have been cleaned up by that point).

There is code that runs in a property changed handler for associating the entries in the dropdown with specific project host objects. It's triggered by a boolean observable property that controls the visibility on the dropdown button. This code doesn't get invoked on the second generation attempt because it was already set to true from the first attempt. So, the entries in the list never get refreshed. The fix is to ensure that in the command for generating the project, we reset that property first. We can't change just that property on its own because otherwise there would be a gap in the UI from the button being hidden, so we ensure that the single-host button (which is the default) is visible (it won't be enabled though). After the generation completes, the dropdown button will be restored, enabled, and point to the right projects.

Validation steps performed

I verified that on a system with multiple project hosts installed, the user can run multiple sequential project generation attempts and that the launch buttons will correctly invoke the latest-generated project each time.

PR checklist

@krschau krschau merged commit b871d3d into main May 15, 2024
4 checks passed
@krschau krschau added this to the Dev Home v0.14 milestone May 15, 2024
EricJohnson327 pushed a commit that referenced this pull request May 16, 2024
…o stale projects (#2930)

Co-authored-by: Aditya Rastogi <adityar@ntdev.microsoft.com>
@krschau krschau removed this from the Dev Home v0.14 milestone May 22, 2024
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.

Quickstart Playground sometimes launches editor using path to stale project
4 participants