feat(web): add shift-click multi-select for sidebar threads#651
Conversation
Add support for selecting multiple threads in the sidebar via Cmd/Ctrl+Click (toggle) and Shift+Click (range select), with bulk context menu actions for Delete and Mark Unread. - New threadSelectionStore (Zustand) for ephemeral selection state with anchor-based range selection and no-op guards - Platform-aware modifier detection (Cmd on Mac, Ctrl elsewhere) matching existing isMacPlatform pattern in terminal-links - Extracted deleteThread helper from handleThreadContextMenu for reuse by bulk delete, with deletedThreadIds set for correct fallback navigation during batch operations - Selected threads share the active thread highlight style - Escape key clears selection; plain click clears and navigates - Right-click on selected thread shows bulk menu; right-click on unselected thread clears selection and shows single-thread menu - 22 unit tests covering toggle, range select, clear, remove, and edge cases (cross-project fallback, anchor stability)
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 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 |
…lk delete When bulk-deleting threads that share a worktree, the stale threads closure caused getOrphanedWorktreePathForThread to see the other threads-being-deleted as still alive, suppressing the orphaned worktree cleanup prompt. Filter out deletedThreadIds (keeping the current thread) so the check correctly identifies worktrees that will have no surviving references.
|
video pls |
|
shift click to me usually does range selection, but this one works the same as cmd clicking by just selecting the one you click? also it uses the same style as the currently active thread so looks like i have more selected than it actually is: CleanShot.2026-03-09.at.17.32.22.mp4 |
I used the same color, so as to not introduce another design style. Can change. Got a color you would like me to use? P.S. If you reach out to me on x: |
|
Here is the latest video. Screen.Recording.2026-03-10.at.11.50.03.am.movFixed the range select, also added a nice little blue highlight color. |
…, and deselect on click away
- avoid clearing selection on mousedown for thread items and marked safe controls - centralize the selection-safe selector and add logic tests for clear vs preserve behavior - simplify thread selection store typing by merging state/actions interface
Summary
Adds multi-select support for sidebar thread items, enabling bulk actions on threads.
Implementation
New:
threadSelectionStore.tsEphemeral Zustand store (no persistence — selection clears on reload) managing:
selectedThreadIds: ReadonlySet<ThreadId>— the selected setanchorThreadId— stable anchor for shift-click range computationtoggleThread,rangeSelectTo,clearSelection,removeFromSelectionRefactored:
Sidebar.tsxdeleteThreadhelper fromhandleThreadContextMenufor reuse by bulk delete. Accepts an optionaldeletedThreadIdsset so bulk delete correctly finds fallback navigation targets.isMacPlatform(navigator.platform)(same pattern asterminal-links.ts) instead of the naivemetaKey || ctrlKeyapproach, so Ctrl+Click on Mac doesn't conflict with context menu.New:
threadSelectionStore.test.ts22 unit tests covering:
clearSelectionno-op guard (referential stability)removeFromSelectionwith anchor cleanup and no-op when nothing matchesVideo
Screen.Recording.2026-03-10.at.11.50.03.am.mov
Verification
bun lint— 0 errors (2 pre-existing warnings in server package, unrelated)bun typecheck— 7/7 packages passbun run test— all 22 new tests pass; 27 pre-existing failures incomposerDraftStore.test.tsandterminalStateStore.test.ts(localStorage unavailability in test env, confirmed identical before this change)Note
Add shift-click and cmd/ctrl-click multi-select for sidebar threads
Macroscope summarized 970066c.