Skip to content

Conversation

@mattermoran
Copy link
Contributor

@mattermoran mattermoran commented Oct 7, 2025

I noticed that branch picker doesn't close until the checkout operation is completed.
While normally it's not an issue, it becomes obvious if there are longer running post checkout hooks. In that case selecting a branch makes it feel like nothing has happened (there's a small indicator in the footer) so it's possible to click it multiple times. Closing the modal before the operation completes leads to the error modal saying Failed to change branch. entity released. Please try again. even though the checkout was successful.

The new behavior is to close the branch picker as soon as the branch is selected. This also aligns with the existing behavior in create_branch where cx.emit(DismissEvent); is called without waiting for repo.update.
And as I mentioned before there an indicator in the footer saying git switch <branch_name> with a spinner thingy.

I also added a check in the picker's open function where it first checks if there's currently an active job and does not show the picker in that case.

If this generally makes sense I can add the tests as well if needed.

P.S I checked how it works in VSCode and yes it also closes the branch picker as soon as the branch is selected. The only difference is that they show the loading indicator right next to the branch name (with a new branch) but in our case the current branch and activity indicator are located in different places.

Before
Screen.Recording.2025-10-08.at.12.59.27.AM.mp4
After
Screen.Recording.2025-10-08.at.1.07.49.AM.mp4

Release Notes:

  • The branch picker now closes immediately after a branch is selected, instead of waiting for the branch switch to complete.

@cla-bot
Copy link

cla-bot bot commented Oct 7, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @mattermoran on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@mattermoran
Copy link
Contributor Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Oct 7, 2025
@cla-bot
Copy link

cla-bot bot commented Oct 7, 2025

The cla-bot has been summoned, and re-checked this pull request!

@maxdeviant maxdeviant changed the title fix(git_ui): close branch selector as soon as branch is selected git_ui: Close branch selector as soon as branch is selected Oct 7, 2025
Copy link
Member

@cole-miller cole-miller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I like this change! Just one point of feedback (and I think it's fine to merge this without adding a test).

Copy link
Member

@cole-miller cole-miller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Looks like this just needs a round of clippy fixes.

@cole-miller cole-miller enabled auto-merge (squash) October 20, 2025 18:38
@cole-miller cole-miller disabled auto-merge October 20, 2025 18:38
@cole-miller cole-miller enabled auto-merge (squash) October 20, 2025 18:38
auto-merge was automatically disabled October 20, 2025 19:25

Head branch was pushed to by a user without write access

@cole-miller cole-miller merged commit ec0efc9 into zed-industries:main Oct 20, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants