Skip to content

feat(sidebar): decouple groups from Group by with a Show groups toggle - #6903

Open
jtalborough wants to merge 1 commit into
stablyai:mainfrom
jtalborough:feat/sidebar-show-groups
Open

jtalborough wants to merge 1 commit into
stablyai:mainfrom
jtalborough:feat/sidebar-show-groups

Conversation

@jtalborough

@jtalborough jtalborough commented Jun 30, 2026 •

Copy link
Copy Markdown

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:

  • None + Show groups on: group folders frame the flat list, each with its worktrees inside, plus a trailing Ungrouped folder for repos with no group.
  • Project + Show groups off: repo headers render flat, without the group-folder wrapper.
  • Project + Show groups on: unchanged from today (group → repo → worktrees).

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.md split 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 own ProjectGroup.tabOrder and are treated as first-class structure.

The toggle (rather than always-on) is deliberate: it preserves the flat firehose that None gives today (show everything, no hierarchy), so both behaviors stay reachable. Default On so existing Project-view behavior is unchanged.

Scope / cross-cutting

  • Renderer + one main-process normalizer (normalizeShowGroups); no new IPC surface (rides the existing ui.set persistence path, like sortBy/projectOrderBy).
  • Cross-platform, SSH/remote, agent- and provider-neutral: pure row construction + UI state.
  • Performance: group bucketing is one pass over the already-sorted worktrees in the none lens; the repo lens is unchanged when on.

Deliberately out of scope (follow-ups)

  • Status / PR views don't yet wrap groups (that's a 2-level outer/inner nesting change).
  • Group headers in the none lens 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.ts covers: None + Show groups builds group folders + a trailing Ungrouped folder with the right worktrees; Show groups off falls back to the single flat all list. Full pnpm lint, tsgo typecheck (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


Open in Stage

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.

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]>
@ghost

ghost commented Jun 30, 2026

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

A new showGroups: boolean field is added to PersistedUIState (defaulting to true). The main-process Store gains a normalizeShowGroups helper used in getUI and updateUI. The renderer UISlice exposes showGroups/setShowGroups and hydrates from persisted state. buildRows gains a showGroups parameter: when true and projectGroups exist, the flat (none) view now calls a new appendFlatGroupedWorktrees helper that emits project-group folder headers with an "Ungrouped" trailing section. SidebarWorkspaceOptionsMenu adds a conditional "Show groups" checkbox item. WorktreeList passes showGroups to buildRows. App.tsx includes showGroups in the persistence payload. Locale strings for showGroups and ungrouped are added across all five language files.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The PR description is detailed, but it does not follow the repo template and omits required AI Review Report and Security Audit sections. Add the missing template sections, include the testing checklist items, and attach screenshots or explicitly state no visual change.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a Show groups toggle to decouple group folders from the Group by lens.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: dd688310-1d8c-4b0a-93b2-bc7b69295cee

📥 Commits

Reviewing files that changed from the base of the PR and between 25a7a6f and ccb75c9.

📒 Files selected for processing (15)
  • src/main/persistence.ts
  • src/renderer/src/App.tsx
  • src/renderer/src/components/sidebar/SidebarWorkspaceOptionsMenu.tsx
  • src/renderer/src/components/sidebar/WorktreeList.tsx
  • src/renderer/src/components/sidebar/worktree-list-groups.test.ts
  • src/renderer/src/components/sidebar/worktree-list-groups.ts
  • src/renderer/src/i18n/locales/en.json
  • src/renderer/src/i18n/locales/es.json
  • src/renderer/src/i18n/locales/ja.json
  • src/renderer/src/i18n/locales/ko.json
  • src/renderer/src/i18n/locales/zh.json
  • src/renderer/src/lib/startup-ui-hydration.ts
  • src/renderer/src/store/slices/ui.ts
  • src/shared/constants.ts
  • src/shared/types.ts

Comment on lines +5624 to +5625
hostLabelById,
showGroups

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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
     }

@AmethystLiang
AmethystLiang requested a review from Jinwoo-H June 30, 2026 18:35
@AmethystLiang AmethystLiang assigned OrcaWin and unassigned Jinwoo-H Jul 20, 2026
@AmethystLiang
AmethystLiang requested review from OrcaWin and removed request for Jinwoo-H July 20, 2026 18:42
bbingz added a commit to bbingz/orca that referenced this pull request Jul 23, 2026
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.
@nwparker nwparker added the enhancement New feature or request label Jul 27, 2026
bbingz added a commit to bbingz/orca that referenced this pull request Jul 27, 2026
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.
bbingz added a commit to bbingz/orca that referenced this pull request Aug 11, 2026
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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants