From 71bfb3c8e0dd5a0d247c185c98fcfa3cc4df8440 Mon Sep 17 00:00:00 2001 From: Bohdan Triapitsyn Date: Mon, 24 Aug 2026 20:50:22 +0300 Subject: [PATCH] fix(header): cap session tabs at 10 --- packages/ui/src/stores/useSessionTabsStore.test.ts | 6 +++--- packages/ui/src/stores/useSessionTabsStore.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ui/src/stores/useSessionTabsStore.test.ts b/packages/ui/src/stores/useSessionTabsStore.test.ts index 5df0aa31..83bec001 100644 --- a/packages/ui/src/stores/useSessionTabsStore.test.ts +++ b/packages/ui/src/stores/useSessionTabsStore.test.ts @@ -32,11 +32,11 @@ describe('useSessionTabsStore', () => { expect(useSessionTabsStore.getState().tabIds).toBe(before); }); - test('caps the working set at 20, evicting the oldest tab', () => { - useSessionTabsStore.setState({ tabIds: Array.from({ length: 20 }, (_, i) => `s${i}`) }); + test('caps the working set at 10, evicting the oldest tab', () => { + useSessionTabsStore.setState({ tabIds: Array.from({ length: 10 }, (_, i) => `s${i}`) }); useSessionTabsStore.getState().ensureTab('s-new'); const ids = useSessionTabsStore.getState().tabIds; - expect(ids).toHaveLength(20); + expect(ids).toHaveLength(10); expect(ids[0]).toBe('s1'); expect(ids.at(-1)).toBe('s-new'); }); diff --git a/packages/ui/src/stores/useSessionTabsStore.ts b/packages/ui/src/stores/useSessionTabsStore.ts index 7c1219ac..2412a960 100644 --- a/packages/ui/src/stores/useSessionTabsStore.ts +++ b/packages/ui/src/stores/useSessionTabsStore.ts @@ -24,7 +24,7 @@ interface SessionTabsStore { removeTabs: (sessionIds: readonly string[]) => void; } -const MAX_SESSION_TABS = 20; +const MAX_SESSION_TABS = 10; type PersistedSessionTabs = { tabIds: string[] };