Repository navigation
feat(sidebar): decouple groups from Group by with a Show groups toggle - #6903
jtalborough wants to merge 1 commit into
Conversation
Groups (folders of projects) only rendered in the Project lens — switching to None/Status/PR threw the folder structure away. But groups are a persistent organizational structure, not a side-effect of one view. Add a persisted `showGroups` UI state (default on) and a "Show groups" toggle in the workspace options menu (surfaced only when groups exist): - None + Show groups on: group folders frame the flat list, each with its worktrees inside, plus a trailing "Ungrouped" folder. - Project + Show groups off: repo headers render flat, without the group-folder wrapper. This mirrors the existing decoupling of project ordering from workspace sort (projectOrderBy vs sortBy). Status/PR wrapping is left for a follow-up. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Ready to review this PR? Stage has broken it down into 7 individual chapters for you: Chapters generated by Stage for commit ccb75c9 on Jun 30, 2026 1:29pm UTC. |
📝 WalkthroughWalkthroughA new 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: dd688310-1d8c-4b0a-93b2-bc7b69295cee
📒 Files selected for processing (15)
src/main/persistence.tssrc/renderer/src/App.tsxsrc/renderer/src/components/sidebar/SidebarWorkspaceOptionsMenu.tsxsrc/renderer/src/components/sidebar/WorktreeList.tsxsrc/renderer/src/components/sidebar/worktree-list-groups.test.tssrc/renderer/src/components/sidebar/worktree-list-groups.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.jsonsrc/renderer/src/lib/startup-ui-hydration.tssrc/renderer/src/store/slices/ui.tssrc/shared/constants.tssrc/shared/types.ts
| hostLabelById, | ||
| showGroups |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Avoid switching lenses when the group row is already visible.
Passing showGroups now allows project-group:* rows in the none view, but the reveal effect still switches any project-group target to repo before checking whether the row is already rendered. This can unexpectedly change the user’s lens instead of scrolling to the visible group.
Proposed fix
- if (isProjectHeaderTarget && groupBy !== 'repo') {
+ if (isProjectHeaderTarget && groupBy !== 'repo' && !renderedSidebarRowKeys.has(rowKey)) {
setGroupBy('repo')
return
}Adds a persisted PersistedUIState.groupBy value 'project-group' so the mobile worktree list can group workspaces by their repo's (or folder workspace's) top-level project group, bidirectionally synced with desktop via ui.get/ui.set. - shared/main: widen the groupBy union + client-ui zod enum + persistence normalizeGroupBy to accept 'project-group'. - desktop: render 'project-group' as the existing 'repo' (Project) nested view via effectiveGroupByForRender while persisting the distinct value, so a phone's choice survives the round-trip and never hits the pr-status fallthrough. - mobile: new projectGroup MobileGroupMode + picker option, a buildSections branch keyed by resolved top-level group (folder-workspace worktrees included via folderWorkspaceRepoId), resolveTopLevelProjectGroupId helper, and toDesktopViewSettingsPayload that only sends groupBy when the grouping mode changes so an old desktop rejecting the new value doesn't drop other view settings. Interacts with the groupBy union reworked in stablyai#6903 — coordinate merge order.
Adds a persisted PersistedUIState.groupBy value 'project-group' so the mobile worktree list can group workspaces by their repo's (or folder workspace's) top-level project group, bidirectionally synced with desktop via ui.get/ui.set. - shared/main: widen the groupBy union + client-ui zod enum + persistence normalizeGroupBy to accept 'project-group'. - desktop: render 'project-group' as the existing 'repo' (Project) nested view via effectiveGroupByForRender while persisting the distinct value, so a phone's choice survives the round-trip and never hits the pr-status fallthrough. - mobile: new projectGroup MobileGroupMode + picker option, a buildSections branch keyed by resolved top-level group (folder-workspace worktrees included via folderWorkspaceRepoId), resolveTopLevelProjectGroupId helper, and toDesktopViewSettingsPayload that only sends groupBy when the grouping mode changes so an old desktop rejecting the new value doesn't drop other view settings. Interacts with the groupBy union reworked in stablyai#6903 — coordinate merge order.
Adds a persisted PersistedUIState.groupBy value 'project-group' so the mobile worktree list can group workspaces by their repo's (or folder workspace's) top-level project group, bidirectionally synced with desktop via ui.get/ui.set. - shared/main: widen the groupBy union + client-ui zod enum + persistence normalizeGroupBy to accept 'project-group'. - desktop: render 'project-group' as the existing 'repo' (Project) nested view via effectiveGroupByForRender while persisting the distinct value, so a phone's choice survives the round-trip and never hits the pr-status fallthrough. - mobile: new projectGroup MobileGroupMode + picker option, a buildSections branch keyed by resolved top-level group (folder-workspace worktrees included via folderWorkspaceRepoId), resolveTopLevelProjectGroupId helper, and toDesktopViewSettingsPayload that only sends groupBy when the grouping mode changes so an old desktop rejecting the new value doesn't drop other view settings. Interacts with the groupBy union reworked in stablyai#6903 — coordinate merge order.
What
Groups (folders of projects) only rendered in the Project lens. Switching Group by → None / Status / PR threw the folder structure away entirely — so a deliberate organizational hierarchy vanished the moment you changed how worktrees were arranged.
This decouples groups from the "Group by" lens with a persisted Show groups toggle (default On), surfaced in the workspace options menu only when groups exist:
Why — and why a toggle
Groups are a persistent organizational structure, not a property of one view. This mirrors a decoupling the project already made deliberately:
docs/reference/project-ordering-mode.mdsplit project header order (projectOrderBy) out from workspace sort (sortBy) for exactly this reason — "header order is currently coupled to workspace sorting instead of having its own user choice." Groups carry their ownProjectGroup.tabOrderand are treated as first-class structure.The toggle (rather than always-on) is deliberate: it preserves the flat firehose that
Nonegives today (show everything, no hierarchy), so both behaviors stay reachable. Default On so existing Project-view behavior is unchanged.Scope / cross-cutting
normalizeShowGroups); no new IPC surface (rides the existingui.setpersistence path, likesortBy/projectOrderBy).nonelens; the repo lens is unchanged when on.Deliberately out of scope (follow-ups)
nonelens render as plain folder headers; the full group context menu (rename/delete) stays gated to the Project lens for now.Tests
worktree-list-groups.test.tscovers: None + Show groups builds group folders + a trailing Ungrouped folder with the right worktrees; Show groups off falls back to the single flatalllist. Fullpnpm lint,tsgotypecheck (node + web), and localization catalog/coverage pass; strings added across en/es/ja/ko/zh.Visual
UI change (Show groups toggle + grouped None view) — screenshots to attach to the PR conversation.
🤖 Generated with Claude Code
ELI5
Project groups (folders of projects) no longer disappear when you change “Group by.” A separate “Show groups” toggle keeps your folder hierarchy visible across None, Status, and PR views.