fix(copilot): record current session mode before switching away

Old sessions (created before the mode fix) didn't have a recorded
mode, so switching away and back would lose the mode. Now we record
the current mode for the departing session before switching.
This commit is contained in:
majdyz
2026-04-13 12:48:03 +00:00
parent 7d16258a98
commit c9fadf20e1

View File

@@ -355,6 +355,12 @@ export function useCopilotPage() {
}
function handleSelectSession(id: string) {
// Record current session's mode before switching away so it's
// preserved when the user switches back — covers sessions created
// before the per-session mode fix was deployed.
if (sessionId) {
recordSessionMode(sessionId);
}
setSessionId(id);
restoreSessionMode(id);
if (isMobile) setDrawerOpen(false);