Skip to content

Commit ba70ad8

Browse files
committed
fix: navigate to the correct session ID when updating session state
1 parent b066ec4 commit ba70ad8

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/components/ChatInterface.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2971,12 +2971,20 @@ function ChatInterface({ selectedProject, selectedSession, ws, sendMessage, mess
29712971
if (latestMessage.sessionId && !currentSessionId) {
29722972
sessionStorage.setItem('pendingSessionId', latestMessage.sessionId);
29732973

2974+
// Mark as system change to prevent clearing messages when session ID updates
2975+
setIsSystemSessionChange(true);
2976+
29742977
// Session Protection: Replace temporary "new-session-*" identifier with real session ID
29752978
// This maintains protection continuity - no gap between temp ID and real ID
29762979
// The temporary session is removed and real session is marked as active
29772980
if (onReplaceTemporarySession) {
29782981
onReplaceTemporarySession(latestMessage.sessionId);
29792982
}
2983+
2984+
// Navigate to the new session to ensure URL and selectedSession are updated
2985+
if (onNavigateToSession) {
2986+
onNavigateToSession(latestMessage.sessionId);
2987+
}
29802988
}
29812989
break;
29822990

0 commit comments

Comments
 (0)