From f167868734d6dcc9fd5964b4b035dbca6892d534 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Mon, 13 Oct 2025 11:12:05 -0700 Subject: [PATCH] fix HOTFIX load last session not last last session (#8201) --- gui/src/hooks/ParallelListeners.tsx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/gui/src/hooks/ParallelListeners.tsx b/gui/src/hooks/ParallelListeners.tsx index e0a2dcf37..3b7d4557d 100644 --- a/gui/src/hooks/ParallelListeners.tsx +++ b/gui/src/hooks/ParallelListeners.tsx @@ -1,4 +1,4 @@ -import { useCallback, useContext, useEffect, useRef } from "react"; +import { useCallback, useContext, useEffect, useRef, useState } from "react"; import { IdeMessengerContext } from "../context/IdeMessenger"; import { FromCoreProtocol } from "core/protocol"; @@ -22,10 +22,7 @@ import { setTTSActive } from "../redux/slices/uiSlice"; import { modelSupportsReasoning } from "core/llm/autodetect"; import { cancelStream } from "../redux/thunks/cancelStream"; import { handleApplyStateUpdate } from "../redux/thunks/handleApplyStateUpdate"; -import { - loadLastSession, - refreshSessionMetadata, -} from "../redux/thunks/session"; +import { loadSession, refreshSessionMetadata } from "../redux/thunks/session"; import { updateFileSymbolsFromHistory } from "../redux/thunks/updateFileSymbols"; import { setDocumentStylesFromLocalStorage, @@ -48,6 +45,8 @@ function ParallelListeners() { // Load symbols for chat on any session change const sessionId = useAppSelector((state) => state.session.id); + const lastSessionId = useAppSelector((store) => store.session.lastSessionId); + const [initialSessionId] = useState(sessionId || lastSessionId); const handleConfigUpdate = useCallback( async (isInitial: boolean, result: FromCoreProtocol["configUpdate"][0]) => { @@ -107,7 +106,14 @@ function ParallelListeners() { await handleConfigUpdate(true, result.content); } dispatch(setConfigLoading(false)); - await dispatch(loadLastSession()); + if (initialSessionId) { + await dispatch( + loadSession({ + sessionId: initialSessionId, + saveCurrentSession: false, + }), + ); + } } void initialLoadConfig(); const interval = setInterval(() => { @@ -125,7 +131,7 @@ function ParallelListeners() { }, 2_000); return () => clearInterval(interval); - }, [hasDoneInitialConfigLoad, ideMessenger]); + }, [hasDoneInitialConfigLoad, ideMessenger, initialSessionId]); useWebviewListener( "configUpdate",