fix: default workspaces grouping to projects (#1513)
This commit is contained in:
@@ -86,7 +86,7 @@ describe('Store', () => {
|
||||
const store = await createStore()
|
||||
const ui = store.getUI()
|
||||
expect(ui.sidebarWidth).toBe(280)
|
||||
expect(ui.groupBy).toBe('none')
|
||||
expect(ui.groupBy).toBe('repo')
|
||||
expect(ui.lastActiveRepoId).toBeNull()
|
||||
expect(ui.dismissedUpdateVersion).toBeNull()
|
||||
expect(ui.lastUpdateCheckAt).toBeNull()
|
||||
@@ -433,7 +433,7 @@ describe('Store', () => {
|
||||
store.updateUI({ sidebarWidth: 400 })
|
||||
const ui = store.getUI()
|
||||
expect(ui.sidebarWidth).toBe(400)
|
||||
expect(ui.groupBy).toBe('none') // default preserved
|
||||
expect(ui.groupBy).toBe('repo') // default preserved
|
||||
expect(ui.dismissedUpdateVersion).toBeNull()
|
||||
})
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable max-lines */
|
||||
import { lazy, Suspense, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
|
||||
import { DEFAULT_STATUS_BAR_ITEMS, DEFAULT_WORKTREE_CARD_PROPERTIES } from '../../shared/constants'
|
||||
import { getDefaultUIState } from '../../shared/constants'
|
||||
|
||||
import { ArrowLeft, ArrowRight, Minimize2, PanelLeft, PanelRight } from 'lucide-react'
|
||||
import { SYNC_FIT_PANES_EVENT, TOGGLE_TERMINAL_PANE_EXPAND_EVENT } from '@/constants/terminal'
|
||||
@@ -335,25 +335,7 @@ function App(): React.JSX.Element {
|
||||
} catch (error) {
|
||||
console.error('Failed to hydrate workspace session:', error)
|
||||
if (!cancelled) {
|
||||
actions.hydratePersistedUI({
|
||||
lastActiveRepoId: null,
|
||||
lastActiveWorktreeId: null,
|
||||
sidebarWidth: 280,
|
||||
rightSidebarWidth: 350,
|
||||
groupBy: 'none',
|
||||
sortBy: 'recent',
|
||||
showActiveOnly: false,
|
||||
hideDefaultBranchWorkspace: false,
|
||||
filterRepoIds: [],
|
||||
collapsedGroups: [],
|
||||
uiZoomLevel: 0,
|
||||
editorFontZoomLevel: 0,
|
||||
worktreeCardProperties: [...DEFAULT_WORKTREE_CARD_PROPERTIES],
|
||||
statusBarItems: [...DEFAULT_STATUS_BAR_ITEMS],
|
||||
statusBarVisible: true,
|
||||
dismissedUpdateVersion: null,
|
||||
lastUpdateCheckAt: null
|
||||
})
|
||||
actions.hydratePersistedUI(getDefaultUIState())
|
||||
actions.hydrateWorkspaceSession({
|
||||
activeRepoId: null,
|
||||
activeWorktreeId: null,
|
||||
|
||||
@@ -100,6 +100,41 @@ describe('buildRows with pinned worktrees', () => {
|
||||
|
||||
expect(rows[0]).toMatchObject({ type: 'header', label: 'c15t' })
|
||||
})
|
||||
|
||||
it('groups folder-mode workspaces under their folder name', () => {
|
||||
const folderRepo: Repo = {
|
||||
...repo,
|
||||
id: 'folder-1',
|
||||
path: '/tmp/design-assets',
|
||||
displayName: 'design-assets',
|
||||
kind: 'folder'
|
||||
}
|
||||
const folderWorktree: Worktree = {
|
||||
...worktree,
|
||||
id: 'folder-1::/tmp/design-assets',
|
||||
repoId: folderRepo.id,
|
||||
path: folderRepo.path,
|
||||
branch: '',
|
||||
displayName: folderRepo.displayName,
|
||||
isMainWorktree: true
|
||||
}
|
||||
const rows = buildRows(
|
||||
'repo',
|
||||
[folderWorktree],
|
||||
new Map([[folderRepo.id, folderRepo]]),
|
||||
null,
|
||||
new Set()
|
||||
)
|
||||
|
||||
expect(rows[0]).toMatchObject({
|
||||
type: 'header',
|
||||
key: 'repo:folder-1',
|
||||
label: 'design-assets',
|
||||
count: 1,
|
||||
repo: folderRepo
|
||||
})
|
||||
expect(rows[1]).toMatchObject({ type: 'item', worktree: { id: folderWorktree.id } })
|
||||
})
|
||||
})
|
||||
|
||||
describe('WorktreeList header styles', () => {
|
||||
|
||||
@@ -522,7 +522,7 @@ export const createUISlice: StateCreator<AppState, [], [], UISlice> = (set, get)
|
||||
return { trustedOrcaHooks: next }
|
||||
}),
|
||||
|
||||
groupBy: 'none',
|
||||
groupBy: 'repo',
|
||||
// Why: group keys are mode-specific (e.g. repo id vs PR status), so
|
||||
// collapsed state from one mode is meaningless in another. Clearing
|
||||
// also prevents unbounded accumulation of stale keys across mode switches.
|
||||
|
||||
@@ -250,7 +250,7 @@ export function getDefaultUIState(): PersistedUIState {
|
||||
lastActiveWorktreeId: null,
|
||||
sidebarWidth: 280,
|
||||
rightSidebarWidth: 350,
|
||||
groupBy: 'none',
|
||||
groupBy: 'repo',
|
||||
sortBy: 'recent',
|
||||
showActiveOnly: false,
|
||||
hideDefaultBranchWorkspace: false,
|
||||
|
||||
Reference in New Issue
Block a user