From 416f91d271dece024c41d76ecdf356b153600801 Mon Sep 17 00:00:00 2001 From: StanleyStetson Date: Sat, 1 Aug 2026 02:02:30 +0300 Subject: [PATCH] fix(test): export VirtualSessionListProps and assert sessions array identity change --- .../chat/sidebar/sessions-section.test.tsx | 23 +++++++++++++++++++ .../app/chat/sidebar/virtual-session-list.tsx | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/app/chat/sidebar/sessions-section.test.tsx b/apps/desktop/src/app/chat/sidebar/sessions-section.test.tsx index a6648f3128..47015dd80c 100644 --- a/apps/desktop/src/app/chat/sidebar/sessions-section.test.tsx +++ b/apps/desktop/src/app/chat/sidebar/sessions-section.test.tsx @@ -155,5 +155,28 @@ describe('SidebarSessionsSection memoization & virtualizer stability', () => { const secondRowsRef = mockVirtualListPropsHistory[1].rows expect(secondRowsRef).not.toBe(firstRowsRef) + + // Change sessions array identity + const updatedSessions = generateSessions(VIRTUALIZE_THRESHOLD + 4) + rerender( + Empty} + label="Sessions" + onArchiveSession={noop} + onDeleteSession={noop} + onResumeSession={noop} + onToggle={noop} + onTogglePin={noop} + open={true} + pinned={false} + sessions={updatedSessions} + workingSessionIdSet={new Set()} + /> + ) + + const thirdRowsRef = mockVirtualListPropsHistory[2].rows + expect(thirdRowsRef).not.toBe(secondRowsRef) }) }) diff --git a/apps/desktop/src/app/chat/sidebar/virtual-session-list.tsx b/apps/desktop/src/app/chat/sidebar/virtual-session-list.tsx index d9cfd6c004..90e10ddc38 100644 --- a/apps/desktop/src/app/chat/sidebar/virtual-session-list.tsx +++ b/apps/desktop/src/app/chat/sidebar/virtual-session-list.tsx @@ -27,7 +27,7 @@ interface SessionRowCommonProps { showProfile?: boolean } -interface VirtualSessionListProps { +export interface VirtualSessionListProps { activeSessionId: null | string className?: string rows: SidebarListRow[]