From 54201d9304f408a635a65aa1eef5ef39cfe6a17d Mon Sep 17 00:00:00 2001 From: Salman Mohammed Date: Mon, 3 Mar 2025 18:42:05 -0500 Subject: [PATCH] fix: use resumed session id in chat view (#1485) --- ui/desktop/src/components/ChatView.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ui/desktop/src/components/ChatView.tsx b/ui/desktop/src/components/ChatView.tsx index ba0df549..c1143081 100644 --- a/ui/desktop/src/components/ChatView.tsx +++ b/ui/desktop/src/components/ChatView.tsx @@ -39,13 +39,12 @@ export default function ChatView({ const [sessionId] = useState(() => { // If resuming a session, use that session ID if (resumedSession?.session_id) { + // Store the resumed session ID in sessionStorage + window.sessionStorage.setItem('goose-session-id', resumedSession.session_id); return resumedSession.session_id; } - const existingId = window.sessionStorage.getItem('goose-session-id'); - if (existingId) { - return existingId; - } + // For a new chat, generate a new session ID const newId = generateSessionId(); window.sessionStorage.setItem('goose-session-id', newId); return newId; @@ -67,7 +66,7 @@ export default function ChatView({ return { id: Date.now(), - title: resumedSession.description || `Chat ${resumedSession.session_id}`, + title: resumedSession.metadata?.description || `ID: ${resumedSession.session_id}`, messages: convertedMessages, }; } catch (e) {