persist sidebar collapsed groups across navigation and restart (#722)

* fix: persist sidebar collapsed groups across navigation and restart

The sidebar's collapsed-group state was stored as local React state in
WorktreeList, so the Sidebar unmount/remount triggered by navigating into
Settings discarded it — returning to the main view re-expanded every
previously collapsed group. Lift the state into the UI slice alongside
groupBy/sortBy/filterRepoIds and persist it via the existing ui:set IPC
so collapse state also survives app restarts.

* fix: clear collapsed groups when switching groupBy mode

Prevents stale keys from accumulating across mode switches and avoids
cross-mode key collisions that could leave groups unexpectedly collapsed.

---------

Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com>
This commit is contained in:
Kelvin Amoaba
2026-04-19 00:23:52 -04:00
committed by GitHub
co-authored by Jinwoo-H
parent 5d985a6563
commit ab81f04fae
5 changed files with 28 additions and 15 deletions
+1
View File
@@ -169,6 +169,7 @@ export function getDefaultUIState(): PersistedUIState {
sortBy: 'name',
showActiveOnly: false,
filterRepoIds: [],
collapsedGroups: [],
uiZoomLevel: 0,
editorFontZoomLevel: 0,
worktreeCardProperties: [...DEFAULT_WORKTREE_CARD_PROPERTIES],
+1
View File
@@ -692,6 +692,7 @@ export type PersistedUIState = {
sortBy: 'name' | 'smart' | 'recent' | 'repo'
showActiveOnly: boolean
filterRepoIds: string[]
collapsedGroups: string[]
uiZoomLevel: number
editorFontZoomLevel: number
worktreeCardProperties: WorktreeCardProperty[]