feat: default sidebar sort to 'recent' instead of alphabetical (#1285)

Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
Brennan Benson
2026-04-30 11:07:54 -07:00
committed by GitHub
co-authored by Orca
parent 559fce6849
commit 0f3aaab9f8
5 changed files with 27 additions and 5 deletions
+18
View File
@@ -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 () => {
+6 -2
View File
@@ -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,
+1 -1
View File
@@ -325,7 +325,7 @@ function App(): React.JSX.Element {
sidebarWidth: 280,
rightSidebarWidth: 350,
groupBy: 'none',
sortBy: 'name',
sortBy: 'recent',
showActiveOnly: false,
filterRepoIds: [],
collapsedGroups: [],
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -227,7 +227,7 @@ export function getDefaultUIState(): PersistedUIState {
sidebarWidth: 280,
rightSidebarWidth: 350,
groupBy: 'none',
sortBy: 'name',
sortBy: 'recent',
showActiveOnly: false,
filterRepoIds: [],
collapsedGroups: [],