Repository navigation
fix(sidebar): activate workspace number shortcuts by rendered sidebar order - #9560
Hanxcellent wants to merge 1 commit into
Conversation
… order Cmd/Ctrl+N previously recomputed workspace order from the store, which could disagree with the rows actually rendered in the sidebar (drag state, collapsed groups, import cards), and folder workspaces were activated through the plain worktree path. The sidebar now publishes its rendered row order in a layout effect, and while it is mounted the shortcut path trusts that published order directly (O(1)); only after unmount does it reconcile against the store. Folder workspaces activate through the dedicated folder path. Fixes stablyai#9497
2e7877b to
52f0f1a
Compare
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📥 CommitsReviewing files that changed from the base of the PR and between 2e7877bdb9e56f246771711fb4d85a1aa2334dfc and 52f0f1a. 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughSidebar shortcut ordering now centralizes agent-send eligibility, collapsed-group handling, host visibility filtering, and rendered workspace ordering. Visible-worktree caching tracks published order and catalog entries while supporting publisher registration and live reconciliation. WorktreeList uses the shared helpers and preserves published IDs during unmount. Workspace-number navigation now activates folder workspaces or worktrees according to the shortcut key format, with tests covering ordering, caching, filtering, and activation routing. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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 |
|
For the record, since this stayed closed and unreviewed: @Hanxcellent, your approach here was substantially correct, and one piece of it is genuinely better than what shipped. #10693 has now fixed the ordering half of #9497 the same way you did — deriving the shortcut order from the sidebar's rendered rows rather than a flat list. The part you had that #10693 does not: But your split is still the more correct call: the plain path skips the I've left that out of #10693 deliberately to keep it to one reviewable concern, and filed it separately so it doesn't get lost. If you'd like to open a focused PR for just that activation split, it'd be welcome — credited to you. Sorry this sat unreviewed after you closed it; the idea was a good one. |
What
Fixes #9497.
Cmd/Ctrl+1..9 workspace shortcuts now activate the Nth row exactly as rendered in the sidebar, and folder workspaces activate through the dedicated folder path instead of the plain worktree path.
Why
The shortcut handler previously recomputed workspace order from the Zustand store (sorting/grouping/filtering). That order could disagree with the rows actually on screen — component-local state such as host drag collapse, collapsed groups, and import cards is invisible to the store — so pressing a number could jump to the wrong workspace. Folder workspaces were also mis-activated as regular worktrees.
How
WorktreeListpublishes its rendered row order from a layout effect (setVisibleWorktreeIds), and registers itself as the order publisher while mounted (registerVisibleWorktreeIdsPublisher).workspace-number-shortcut-activation.tsroutes folder workspaces throughactivateAndRevealFolderWorkspace.No visual change.
Tests
visible-worktree-shortcut-order.test.ts(published-order trust while mounted, reconciliation after unmount, empty-order handling) andworkspace-number-shortcut-activation.test.ts(folder vs worktree activation routing). All were written red-first.pnpm typecheckpassed.pnpm buildpassed. Fullpnpm test: identical pass/fail set tomainon the same machine (remaining failures are pre-existing local-environment issues onmain, e.g. missing optionalwindows-native-registry).AI code review summary
Reviewed by a Codex reviewer agent over the full diff; final verdict: no actionable findings.
worktree-activationpaths, which are host-agnostic; no assumptions of local-only execution.Platform / remote notes
Verified on macOS. The change is renderer-only ordering logic behind the existing platform-checked shortcut handler, so no platform- or SSH-specific behavior differences are expected.
X handle: (contributor: add your handle here)