From 6f9316b67b1ed994deb961c738591bf0f3210722 Mon Sep 17 00:00:00 2001 From: Jonathan Hult Date: Mon, 26 Jan 2026 11:14:38 -0600 Subject: [PATCH] fix: dispatch ADD_ACTIVE_SESSION event before navigating from "View All" (#6679) Signed-off-by: Jonathan Co-authored-by: Zane Staggs --- .../src/components/ChatSessionsContainer.tsx | 17 +++++++++-------- ui/desktop/src/components/Layout/AppLayout.tsx | 14 ++++++-------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/ui/desktop/src/components/ChatSessionsContainer.tsx b/ui/desktop/src/components/ChatSessionsContainer.tsx index d7d34566..f429e2f4 100644 --- a/ui/desktop/src/components/ChatSessionsContainer.tsx +++ b/ui/desktop/src/components/ChatSessionsContainer.tsx @@ -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 (
diff --git a/ui/desktop/src/components/Layout/AppLayout.tsx b/ui/desktop/src/components/Layout/AppLayout.tsx index 99f72136..4490dd51 100644 --- a/ui/desktop/src/components/Layout/AppLayout.tsx +++ b/ui/desktop/src/components/Layout/AppLayout.tsx @@ -116,14 +116,12 @@ const AppLayoutContent: React.FC = ({ activeSessions }) = /> - {isOnPairRoute ? ( - <> - - - - ) : ( - - )} + + {/* Always render ChatSessionsContainer to keep SSE connections alive. + When navigating away from /pair */} +
+ +
);