feat(desktop): add branch switcher dropdown in changes panel#3482
feat(desktop): add branch switcher dropdown in changes panel#3482ttmouse wants to merge 2 commits into
Conversation
Show current git branch name in the Changed-files view with a dropdown to switch branches and a refresh button to reload changes. Backend: - Add GitBranch field to WorkspaceChangesView - Add workspaceGitBranch() helper - Add GitBranches() and GitCheckout() bindings Frontend: - Add branch indicator bar with dropdown menu - Add refresh button with spinning animation - Add workspace-branch CSS styles - Add mock implementations for GitBranches/GitCheckout - Update WorkspaceChangesView type with gitBranch field Tests: - Add GitBranch assertion to existing git status test - Add TestWorkspaceChangesGitBranchDetachedHead - Add gitOutput test helper
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4104b4b3e6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } catch { | ||
| // Error message shown via the changes view |
There was a problem hiding this comment.
Surface checkout failures to the user
When git checkout fails, for example because the current worktree has uncommitted changes that would be overwritten by the target branch, this catch block swallows the error and the loadChanges() call is skipped. The menu then closes in finally with the branch unchanged and no message in the changes view, so users cannot tell why the switch did not happen.
Useful? React with 👍 / 👎.
| border: 1px solid var(--border); | ||
| border-radius: 6px; | ||
| box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2); | ||
| overflow: hidden; |
There was a problem hiding this comment.
For repositories with enough local branches to exceed the 300px cap, the popover is clipped because the outer menu has max-height plus overflow: hidden, while the intended scroll container (.workspace-branch-menu__inner) has no constrained height. The inner element expands to its full content height, so no scrollbar is created and lower branches become unreachable.
Useful? React with 👍 / 👎.
| setSwitchingBranch(true); | ||
| try { | ||
| await app.GitCheckout(branch); | ||
| await loadChanges(); |
There was a problem hiding this comment.
Refresh workspace files after checkout
After a successful branch switch this only reloads the changed-files view, but the file browser is backed by the cached entriesByDir tree and selected preview state, which are not invalidated here. If the target branch adds, removes, or changes files, switching back to the Files tab can show stale entries/previews from the previous branch until the user manually refreshes.
Useful? React with 👍 / 👎.
|
Please first fix the issues reported by the bot above. Also, kindly attach the screenshots of the code running results. Thank you. |
esengine
left a comment
There was a problem hiding this comment.
Branch indicator + switcher in the changes panel. exec.Command (no shell injection), dirty-tree checkout failures surface git's own error rather than silently dropping changes. Suggest a follow-up to reject branch args starting with '-'.
* feat(desktop): add branch switcher dropdown in changes panel Show current git branch name in the Changed-files view with a dropdown to switch branches and a refresh button to reload changes. Backend: - Add GitBranch field to WorkspaceChangesView - Add workspaceGitBranch() helper - Add GitBranches() and GitCheckout() bindings Frontend: - Add branch indicator bar with dropdown menu - Add refresh button with spinning animation - Add workspace-branch CSS styles - Add mock implementations for GitBranches/GitCheckout - Update WorkspaceChangesView type with gitBranch field Tests: - Add GitBranch assertion to existing git status test - Add TestWorkspaceChangesGitBranchDetachedHead - Add gitOutput test helper * fix(desktop): branch menu add background and increase height --------- Co-authored-by: ttmouse <ttmouseg@gmail.com> Co-authored-by: reasonix <reasonix@deepseek.com>
Show the current Git branch name in the Changed-files view with a dropdown to switch branches and a refresh button to reload changes.
Backend
GitBranchfield toWorkspaceChangesViewstructworkspaceGitBranch()helper (supports named branch and detached HEAD)GitBranches()andGitCheckout()app bindingsFrontend
gitBranch?: stringtoWorkspaceChangesViewGitBranches()andGitCheckout()toAppBindings+ mock implementations.workspace-branch-indicator,.workspace-branch-menu(with background, border, shadow),.workspace-branch-refreshwithspinanimationTests
GitBranchin existingTestWorkspaceChangesGitStatusTestWorkspaceChangesGitBranchDetachedHeadfor detached HEAD scenariogitOutput()test helperVerification
wails buildsucceeds (darwin/arm64)