fix: dispatch ADD_ACTIVE_SESSION event before navigating from "View All" (#6679)

Signed-off-by: Jonathan <jonathan@example.com>
Co-authored-by: Zane Staggs <zane@squareup.com>
This commit is contained in:
Jonathan Hult
2026-01-26 11:14:38 -06:00
committed by GitHub
parent 82ba07ff1d
commit 6f9316b67b
2 changed files with 15 additions and 16 deletions
@@ -23,17 +23,18 @@ export default function ChatSessionsContainer({
const [searchParams] = useSearchParams();
const currentSessionId = searchParams.get('resumeSessionId') ?? undefined;
if (!currentSessionId) {
// Always render active sessions to keep SSE connections alive, even when not on /pair route
if (!currentSessionId && activeSessions.length === 0) {
return null;
}
const isActiveSession = activeSessions.some((s) => s.sessionId === currentSessionId);
// If the current session isn't in active sessions, we need to render it anyway
// (handles page refresh case)
const sessionsToRender = isActiveSession
? activeSessions
: [...activeSessions, { sessionId: currentSessionId }];
// Build the list of sessions to render
let sessionsToRender = activeSessions;
// If we have a currentSessionId that's not in activeSessions, add it (handles page refresh)
if (currentSessionId && !activeSessions.some((s) => s.sessionId === currentSessionId)) {
sessionsToRender = [...activeSessions, { sessionId: currentSessionId }];
}
return (
<div className="relative w-full h-full">
@@ -116,14 +116,12 @@ const AppLayoutContent: React.FC<AppLayoutContentProps> = ({ activeSessions }) =
/>
</Sidebar>
<SidebarInset>
{isOnPairRoute ? (
<>
<Outlet />
<ChatSessionsContainer setChat={setChat} activeSessions={activeSessions} />
</>
) : (
<Outlet />
)}
<Outlet />
{/* Always render ChatSessionsContainer to keep SSE connections alive.
When navigating away from /pair */}
<div className={isOnPairRoute ? 'contents' : 'hidden'}>
<ChatSessionsContainer setChat={setChat} activeSessions={activeSessions} />
</div>
</SidebarInset>
</div>
);