From ba70ad8e81443916224f9808c50cd29bf283c4e1 Mon Sep 17 00:00:00 2001 From: Haileyesus Dessie <118998054+blackmammoth@users.noreply.github.com> Date: Wed, 31 Dec 2025 19:10:33 +0300 Subject: [PATCH] fix: navigate to the correct session ID when updating session state --- src/components/ChatInterface.jsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/ChatInterface.jsx b/src/components/ChatInterface.jsx index 337513c..e8b0a40 100644 --- a/src/components/ChatInterface.jsx +++ b/src/components/ChatInterface.jsx @@ -2971,12 +2971,20 @@ function ChatInterface({ selectedProject, selectedSession, ws, sendMessage, mess if (latestMessage.sessionId && !currentSessionId) { sessionStorage.setItem('pendingSessionId', latestMessage.sessionId); + // Mark as system change to prevent clearing messages when session ID updates + setIsSystemSessionChange(true); + // Session Protection: Replace temporary "new-session-*" identifier with real session ID // This maintains protection continuity - no gap between temp ID and real ID // The temporary session is removed and real session is marked as active if (onReplaceTemporarySession) { onReplaceTemporarySession(latestMessage.sessionId); } + + // Navigate to the new session to ensure URL and selectedSession are updated + if (onNavigateToSession) { + onNavigateToSession(latestMessage.sessionId); + } } break;