Skip to content

feat: split worktree/diff-type into separate controls#248

Merged
backnotprop merged 3 commits intomainfrom
feat/worktree-ux-redesign
Mar 8, 2026
Merged

feat: split worktree/diff-type into separate controls#248
backnotprop merged 3 commits intomainfrom
feat/worktree-ux-redesign

Conversation

@backnotprop
Copy link
Owner

Summary

  • The single dropdown that mixed diff type selection with worktree switching was confusing — entering a worktree silently replaced all options with no indicator of which worktree was active
  • Split into two controls: Context dropdown (repo/worktree switcher, only shown when worktrees exist) and View dropdown (always the same diff type options)
  • Context dropdown highlights with a primary-colored border when a worktree is active
  • Users can now switch directly between worktrees without going "back to main" first

Test plan

  • Run ./tests/manual/local/test-worktree-review.sh to launch sandbox with 4 worktrees
  • Verify Context dropdown appears above View dropdown listing worktrees with "(worktree)" label
  • Select a worktree — pill highlights, files update to that worktree's changes
  • Switch View options (Uncommitted/Last commit/vs main) within a worktree context
  • Switch directly between worktrees without returning to main
  • Switch back to main branch in Context — restores main repo files
  • Empty worktree shows appropriate empty state
  • Detached HEAD worktree uses directory name as label
  • Without worktrees: Context dropdown doesn't render, View dropdown works as before

🤖 Generated with Claude Code

backnotprop and others added 3 commits March 8, 2026 15:33
The single dropdown that mixed diff type selection (uncommitted, last-commit,
branch) with worktree switching was confusing — entering a worktree silently
replaced all dropdown options with no persistent indicator of which worktree
was active.

Split into two controls:
- Context dropdown: switches between main repo and worktrees (only shown
  when worktrees exist, highlighted when a worktree is active)
- View dropdown: always shows the same diff type options regardless of context

Server changes:
- GitContext now exposes worktrees as a separate field
- Removed getWorktreeDiffOptions() and back-to-main sentinel handling
- Simplified /api/diff/switch (no more diffOptions replacement)

Client changes:
- New activeWorktreePath state + handleWorktreeSwitch callback
- handleDiffSwitch composes worktree prefix from context automatically
- Derived activeDiffBase strips worktree prefix for dropdown display

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… state

Eliminates redundant state — activeWorktreePath and activeDiffBase are
now both derived in a single useMemo from the composite diffType string.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…hared

Eliminates duplicate interface definitions across server and client.
Types now live in packages/shared/types.ts and are imported by both
packages/server/git.ts and packages/review-editor/.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@backnotprop
Copy link
Owner Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@backnotprop backnotprop merged commit 933f447 into main Mar 8, 2026
3 checks passed
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.

1 participant