fix(desktop): default session list density to compact

Keeps the sidebar byte-identical for existing users until they opt into
comfortable/detailed themselves — per the no-default-change salvage rule.
This commit is contained in:
Teknium
2026-08-14 23:20:04 -07:00
parent 8ea53d7cea
commit 865e4e7178
2 changed files with 8 additions and 6 deletions
@@ -11,10 +11,10 @@ describe('session list density preference', () => {
window.localStorage.clear()
})
it('defaults to comfortable and persists changes', async () => {
it('defaults to compact (pre-density behavior) and persists changes', async () => {
const first = await loadStore()
expect(first.$sessionListDensity.get()).toBe('comfortable')
expect(first.$sessionListDensity.get()).toBe('compact')
first.setSessionListDensity('detailed')
@@ -22,9 +22,9 @@ describe('session list density preference', () => {
expect((await loadStore()).$sessionListDensity.get()).toBe('detailed')
})
it('falls back to comfortable for an unknown stored value', async () => {
it('falls back to compact for an unknown stored value', async () => {
window.localStorage.setItem('hermes.desktop.sessionListDensity', 'tiny')
expect((await loadStore()).$sessionListDensity.get()).toBe('comfortable')
expect((await loadStore()).$sessionListDensity.get()).toBe('compact')
})
})
@@ -4,12 +4,14 @@ export type SessionListDensity = 'compact' | 'comfortable' | 'detailed'
const STORAGE_KEY = 'hermes.desktop.sessionListDensity'
// Compact is the pre-density row exactly as it shipped, so existing users see
// no change until they opt into a denser-information mode themselves (#68119).
const densityCodec: Codec<SessionListDensity> = {
decode: raw => (raw === 'compact' || raw === 'detailed' ? raw : 'comfortable'),
decode: raw => (raw === 'comfortable' || raw === 'detailed' ? raw : 'compact'),
encode: value => value
}
export const $sessionListDensity = persistentAtom<SessionListDensity>(STORAGE_KEY, 'comfortable', densityCodec)
export const $sessionListDensity = persistentAtom<SessionListDensity>(STORAGE_KEY, 'compact', densityCodec)
export function setSessionListDensity(density: SessionListDensity) {
$sessionListDensity.set(density)