fix: navigate to the correct session ID when updating session state

This commit is contained in:
Haileyesus Dessie
2025-12-31 19:10:33 +03:00
parent b066ec4c01
commit ba70ad8e81

View File

@@ -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;