fix(header): cap session tabs at 10

This commit is contained in:
Bohdan Triapitsyn
2026-08-24 20:50:22 +03:00
parent dcacf4b3fc
commit 71bfb3c8e0
2 changed files with 4 additions and 4 deletions
@@ -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');
});
@@ -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[] };