fix(sidebar): keep pinned worktrees in grouped lists#4745
Open
tmchow wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — makes pinned worktrees visible in their natural sidebar groups (All, repo, status) while keeping the Pinned section as a shortcut overlay, and distinguishes which copy the user clicked via primary/secondary active surface styling.
- Pinned overlay model —
emitPinnedGroupno longer returns a pinned-ID exclusion set;buildRowsand all group-by modes iterate the full worktree list so group labels remain literal. - Dual-row active surface —
markSidebarWorktreeActiveImmediatelyhandles multiple DOM rows for the same worktree ID; the clicked copy gets primary styling (filled border) and the other copy gets secondary (ring accent). - Suppressed sidebar reveal on sidebar click —
activateAndRevealWorktreeacceptsrevealInSidebar: false, preventing scroll jumps back to the first mounted copy when clicking the natural-group row. - Row-scoped rename —
renamingWorktreeIdbecomes{ worktreeId, rowKey? }, so rename opens on the specific row that was clicked rather than both copies. - Drag safety — pinned overlay rows are excluded from
getWorktreeDragGroupsandgetWorktreeDragUnitGroups, and keyboard-navigation deduplication guards duplicated worktree IDs inrenderedWorktreeIdsandselectedWorktrees. - Section activity — pinned worktrees contribute activity to both Pinned and natural section headers.
- Sleep flow —
findSidebarWorktreeRownow locates rows viadata-worktree-idinstead of the old virtual-row key, matching the scoped-row model.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
Contributor
Author
|
@nwparker @AmethystLiang potentially controversial change 🙈 |
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
Pinned worktrees now stay visible in the groups that claim to contain them. Before this change, pinning a worktree removed it from its repo, status, or
Allgrouping, which made those sections read as partial lists even when their labels promised otherwise. The pinned section now behaves as a shortcut overlay instead of a relocation target: the same worktree can appear in Pinned and in its natural repo/status/all section.That creates an intentional duplicate-row situation, so the sidebar now distinguishes which copy the user actually selected. Both rows remain semantically current because they represent the same active worktree, but the clicked row gets the primary active surface while the other copy gets a secondary active surface. Sidebar clicks also stop re-revealing the first mounted copy, so selecting the natural repo/status row no longer jumps the scroll position back to the pinned row at the top.
Behavior
All,In progress, and repo groups could silently omit pinned worktrees.Demo
CleanShot.2026-06-06.at.00.29.45.mp4
Test Plan
pnpm exec vitest run --config config/vitest.config.ts src/renderer/src/lib/sidebar-worktree-activation.test.ts src/renderer/src/components/sidebar/WorktreeCard.test.ts src/renderer/src/components/sidebar/WorktreeCard.quick-actions.test.tsx src/renderer/src/components/sidebar/WorktreeList.lineage-child-card.test.ts src/renderer/src/components/sidebar/sleep-worktree-flow.test.ts src/renderer/src/components/sidebar/worktree-list-groups.test.ts src/renderer/src/components/sidebar/worktree-section-activity.test.ts src/renderer/src/components/sidebar/worktree-drag-units.test.ts src/renderer/src/components/sidebar/worktree-manual-order.test.ts src/renderer/src/components/sidebar/worktree-list-imported-rows.test.ts src/renderer/src/components/sidebar/worktree-list-sticky-headers.test.ts src/renderer/src/store/slices/worktrees.test.tspnpm run typecheck:webpnpm exec oxlint src/renderer/src/assets/main.css src/renderer/src/components/sidebar/WorktreeCard.tsx src/renderer/src/components/sidebar/WorktreeList.tsx src/renderer/src/components/sidebar/WorktreeCard.test.ts src/renderer/src/components/sidebar/WorktreeCard.quick-actions.test.tsx src/renderer/src/components/sidebar/WorktreeList.lineage-child-card.test.ts src/renderer/src/components/sidebar/sleep-worktree-flow.ts src/renderer/src/components/sidebar/sleep-worktree-flow.test.ts src/renderer/src/components/sidebar/worktree-drag-units.ts src/renderer/src/components/sidebar/worktree-drag-units.test.ts src/renderer/src/components/sidebar/worktree-list-groups.ts src/renderer/src/components/sidebar/worktree-list-groups.test.ts src/renderer/src/components/sidebar/worktree-list-imported-rows.test.ts src/renderer/src/components/sidebar/worktree-list-sticky-headers.test.ts src/renderer/src/components/sidebar/worktree-section-activity.ts src/renderer/src/components/sidebar/worktree-section-activity.test.ts src/renderer/src/lib/sidebar-worktree-activation.ts src/renderer/src/lib/sidebar-worktree-activation.test.ts src/renderer/src/lib/worktree-activation.ts src/renderer/src/store/slices/worktree-helpers.ts src/renderer/src/store/slices/worktrees.ts src/renderer/src/store/slices/worktrees.test.ts