fix HOTFIX load last session not last last session (#8201)

This commit is contained in:
Dallin Romney 2025-10-13 11:12:05 -07:00 • committed by GitHub
parent d394279da3
commit f167868734
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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",