Skip to content

feat(web): collapse same-worktree chats into one sidebar row - #15

Merged
enisze merged 1 commit into
mainfrom
t3code/hide-same-workspace-chats
Aug 1, 2026
Merged

feat(web): collapse same-worktree chats into one sidebar row#15
enisze merged 1 commit into
mainfrom
t3code/hide-same-workspace-chats

Conversation

@enisze

@enisze enisze commented Aug 1, 2026

Copy link
Copy Markdown
Owner

What

Chats spawned into the same git worktree via the in-chat worktree tab strip no longer each get their own sidebar row. A worktree now appears as a single sidebar row — the earliest-created chat — and its sibling chats are reachable only through the tabs inside that chat. Chats with no worktree are unchanged (one row each).

Applies to both sidebars: v1 (Sidebar.tsx) and v2 (SidebarV2.tsx, default on dev/nightly).

How

  • New pure helper collapseWorktreeSiblings(threads, keyOf) in Sidebar.logic.ts — groups by environmentId + worktreePath, keeps the earliest-created chat per group (ties broken by id), preserves order, and returns a representativeKeyByThreadKey map.
  • v1: collapses each project's thread list; the project status dot still reads all non-archived threads so a busy sibling isn't hidden. Mirrored in the jump-label/prewarm pass. Active-route highlight, collapsed-pin, and keyboard traversal remap to the representative row.
  • v2: collapses before the active/snoozed/settled partitioning; remaps highlight, the "keep the open thread visible" shelf pull-ins, and keyboard traversal.
  • 5 new unit tests for the helper.

Verification

  • pnpm typecheck (apps/web): clean
  • vp lint on changed files: clean
  • Sidebar.logic.test.ts: 86/86 pass

Note on the representative

The representative is the earliest chat (stable title/position). In v2 the row's active/settled bucket follows that earliest chat's status — a known tradeoff of choosing stability over "surface the most recent activity."

🤖 Generated with Claude Code

Chats spawned into the same git worktree via the in-chat worktree tab
strip no longer each claim their own sidebar row. A worktree now shows as
a single row — the earliest-created chat — and its siblings are reachable
only through the tab strip. Chats with no worktree are unchanged.

Add collapseWorktreeSiblings to Sidebar.logic and apply it in both the v1
sidebar (per project) and the v2 sidebar (before active/snoozed/settled
partitioning). When the active route is a collapsed sibling, its
representative row highlights, pins when collapsed, gets pulled into view
in the settled/snoozed shelves, and keyboard traversal steps relative to
it. The v1 project status dot still reads every non-archived thread so a
busy sibling is never hidden behind its row.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@enisze
enisze merged commit fcc406a into main Aug 1, 2026
@enisze
enisze deleted the t3code/hide-same-workspace-chats branch August 1, 2026 21:44
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