Show branch/worktree selector immediately for drafts - #158
Merged
Conversation
Removes the "Branch / worktree" intermediate toggle, which was a perf-deferral leftover, not a real UX step: for non-git-repo drafts, clicking it just made it vanish with nothing to replace it, since the git-status query it gated only resolved after the click. The full branch selector now renders immediately for any git-repo subject, and the (heavier) ref-list fetch defers to the branch dropdown's first open instead, uniformly for drafts and committed threads. Also freezes a thread's workspace mode the instant it's committed (rather than only once it has a worktree), and switches branch- checkout-conflict errors from an inline span to a toast. See ADR 0022 for why worktree reuse across threads was rejected. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe composer now renders Git workspace controls directly for drafts. Branch references load only after menu activation. Committed composers lock workspace selection, and checkout errors use toast notifications. Documentation defines Worktree terminology and the frozen workspace policy. ChangesComposer workspace flow
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Composer
participant ComposerLowerChrome
participant ComposerBranchToolbar
participant GitRefsQuery
participant BranchMutation
participant SonnerToast
Composer->>ComposerLowerChrome: provide draft and Git repository state
ComposerLowerChrome->>ComposerBranchToolbar: render workspace controls
ComposerBranchToolbar->>GitRefsQuery: load refs when a branch menu opens
ComposerBranchToolbar->>BranchMutation: request branch checkout
BranchMutation-->>ComposerBranchToolbar: return checkout error
ComposerBranchToolbar->>SonnerToast: display error toast
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
ComposerBranchToolbarnow renders immediately for any git-repo subject (draft or committed); the heavier ref-list fetch (listGitRefs/listProjectGitRefs) defers to the branch dropdown's first open instead, uniformly for drafts and committed threads.Current checkout/New worktree) the instant it's committed, rather than only once it has a worktree — seedocs/adr/0022-thread-workspace-frozen-at-commit-never-shared.mdfor the rationale, including why reusing a worktree across threads was explicitly rejected (unguarded concurrent-write risk if two threads shared one working directory).branchAlreadyCheckedOutError) from an inline red-text span to a toast.Worktreeglossary entry toCONTEXT.md.Frontend-only (
apps/web) — no worker/backend changes.Closes #146.
Test plan
bun run check:types(all packages)bun run test:unit— 145 vitest + 119 bun tests passComposerBranchToolbar(deferred ref fetch, workspace lock, toast-not-inline error) andComposerLowerChrome(toggle removed, toolbar renders directly)ultracite checkclean🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Documentation