diff --git a/apps/desktop/src/app/chat/sidebar/index.tsx b/apps/desktop/src/app/chat/sidebar/index.tsx index 4fb0bc0c4dd66..f1587dcc3dc80 100644 --- a/apps/desktop/src/app/chat/sidebar/index.tsx +++ b/apps/desktop/src/app/chat/sidebar/index.tsx @@ -1311,8 +1311,17 @@ export function ChatSidebar({ [agentProjectTree] ) + // Mirror the section's own virtualization inputs (the props it receives), + // not the raw tree cache: agentProjectTree persists after leaving Project + // grouping, and keying on it here while the section keys on projectOverview + // (which is nulled the moment grouping changes) left the two disagreeing — + // wrapper classes built for a virtualized list around a non-virtual one. + // Entered-project content is the third prop that suppresses virtualization. const recentsVirtualizes = - !displayAgentGroups?.length && !agentProjectTree?.length && displayAgentSessions.length >= VIRTUALIZE_THRESHOLD + !displayAgentGroups?.length && + !projectOverview?.length && + !(inProject && enteredProjectContent) && + displayAgentSessions.length >= VIRTUALIZE_THRESHOLD // Keep the persisted parent + worktree orders reconciled with what's on screen: // freshly-seen repos/worktrees surface at the top, vanished ones drop out of @@ -1552,17 +1561,21 @@ export function ChatSidebar({