mirror of
https://github.com/stablyai/orca.git
synced 2026-10-27 00:02:48 +00:00
feat: default sidebar sort to 'recent' instead of alphabetical
Gate the legacy-recent→smart migration on the raw persisted sortBy value rather than the normalized default. Otherwise, flipping the default would sweep fresh installs (no persisted sortBy) into the migration and lock them onto 'smart' via the sticky migrated flag. Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -433,6 +433,24 @@ describe('Store', () => {
|
||||
expect(store.getUI().sortBy).toBe('recent')
|
||||
})
|
||||
|
||||
it('uses recent as the default sort for a fresh install (no persisted sortBy)', async () => {
|
||||
// Why: the legacy-recent→smart migration must gate on the *raw* persisted
|
||||
// value, not the normalized default. Otherwise, changing the default sort
|
||||
// to 'recent' would cause every fresh install to be mis-migrated to 'smart'.
|
||||
writeDataFile({
|
||||
schemaVersion: 1,
|
||||
repos: [],
|
||||
worktreeMeta: {},
|
||||
settings: {},
|
||||
ui: {},
|
||||
githubCache: { pr: {}, issue: {} },
|
||||
workspaceSession: {}
|
||||
})
|
||||
|
||||
const store = await createStore()
|
||||
expect(store.getUI().sortBy).toBe('recent')
|
||||
})
|
||||
|
||||
// ── terminalMacOptionAsAlt migration (issue #903) ───────────────────
|
||||
|
||||
it('migrates legacy "true" terminalMacOptionAsAlt to "auto" on first load', async () => {
|
||||
|
||||
@@ -156,9 +156,13 @@ export class Store {
|
||||
// Why: 'recent' used to mean the weighted smart sort. One-shot
|
||||
// migration moves it to 'smart'; the flag prevents re-firing after
|
||||
// a user intentionally selects the new last-activity 'recent' sort.
|
||||
// Gate on the *raw* persisted value, not the normalized one: the
|
||||
// default sortBy is now 'recent', so a fresh install with no
|
||||
// persisted sortBy would otherwise be mis-migrated to 'smart'.
|
||||
ui: (() => {
|
||||
const sort = normalizeSortBy(parsed.ui?.sortBy)
|
||||
const migrate = !parsed.ui?._sortBySmartMigrated && sort === 'recent'
|
||||
const rawSort = parsed.ui?.sortBy
|
||||
const sort = normalizeSortBy(rawSort)
|
||||
const migrate = !parsed.ui?._sortBySmartMigrated && rawSort === 'recent'
|
||||
return {
|
||||
...defaults.ui,
|
||||
...parsed.ui,
|
||||
|
||||
@@ -325,7 +325,7 @@ function App(): React.JSX.Element {
|
||||
sidebarWidth: 280,
|
||||
rightSidebarWidth: 350,
|
||||
groupBy: 'none',
|
||||
sortBy: 'name',
|
||||
sortBy: 'recent',
|
||||
showActiveOnly: false,
|
||||
filterRepoIds: [],
|
||||
collapsedGroups: [],
|
||||
|
||||
@@ -429,7 +429,7 @@ export const createUISlice: StateCreator<AppState, [], [], UISlice> = (set, get)
|
||||
set({ groupBy: g, collapsedGroups: new Set<string>() })
|
||||
},
|
||||
|
||||
sortBy: 'name',
|
||||
sortBy: 'recent',
|
||||
setSortBy: (s) => set({ sortBy: s }),
|
||||
|
||||
showActiveOnly: false,
|
||||
|
||||
@@ -227,7 +227,7 @@ export function getDefaultUIState(): PersistedUIState {
|
||||
sidebarWidth: 280,
|
||||
rightSidebarWidth: 350,
|
||||
groupBy: 'none',
|
||||
sortBy: 'name',
|
||||
sortBy: 'recent',
|
||||
showActiveOnly: false,
|
||||
filterRepoIds: [],
|
||||
collapsedGroups: [],
|
||||
|
||||
Reference in New Issue
Block a user