diff --git a/gui/src/pages/gui/Chat.tsx b/gui/src/pages/gui/Chat.tsx index 08ca69498..f7e9c308d 100644 --- a/gui/src/pages/gui/Chat.tsx +++ b/gui/src/pages/gui/Chat.tsx @@ -43,14 +43,14 @@ import { streamResponseThunk } from "../../redux/thunks/streamResponse"; import { isJetBrains, isMetaEquivalentKeyPressed } from "../../util"; import { ToolCallDiv } from "./ToolCallDiv"; +import { useStore } from "react-redux"; import { FatalErrorIndicator } from "../../components/config/FatalErrorNotice"; import InlineErrorMessage from "../../components/mainInput/InlineErrorMessage"; +import { RootState } from "../../redux/store"; import { cancelStream } from "../../redux/thunks/cancelStream"; import { EmptyChatBody } from "./EmptyChatBody"; import { ExploreDialogWatcher } from "./ExploreDialogWatcher"; import { useAutoScroll } from "./useAutoScroll"; -import { useStore } from "react-redux"; -import { RootState } from "../../redux/store"; // Helper function to find the index of the latest conversation summary function findLatestSummaryIndex(history: ChatHistoryItem[]): number { @@ -431,11 +431,7 @@ export function Chat() { {history.length === 0 && lastSessionId && !isInEdit && ( { - await dispatch( - loadLastSession({ - saveCurrentSession: true, - }), - ); + await dispatch(loadLastSession()); }} className="flex items-center gap-2" > diff --git a/gui/src/redux/thunks/edit.ts b/gui/src/redux/thunks/edit.ts index 700d49d55..c2192ab9e 100644 --- a/gui/src/redux/thunks/edit.ts +++ b/gui/src/redux/thunks/edit.ts @@ -109,11 +109,7 @@ export const exitEdit = createAsyncThunk< if (openNewSession || state.editModeState.lastNonEditSessionWasEmpty) { dispatch(newSession()); } else { - await dispatch( - loadLastSession({ - saveCurrentSession: false, - }), - ); + await dispatch(loadLastSession()); } dispatch(setMode(state.editModeState.returnToMode)); diff --git a/gui/src/redux/thunks/session.ts b/gui/src/redux/thunks/session.ts index c2fe35c36..8172d7b7c 100644 --- a/gui/src/redux/thunks/session.ts +++ b/gui/src/redux/thunks/session.ts @@ -1,5 +1,5 @@ import { createAsyncThunk, unwrapResult } from "@reduxjs/toolkit"; -import { ChatMessage, Session, BaseSessionMetadata } from "core"; +import { BaseSessionMetadata, ChatMessage, Session } from "core"; import { RemoteSessionMetadata } from "core/control-plane/client"; import { NEW_SESSION_TITLE } from "core/util/constants"; import { renderChatMessage } from "core/util/messageContent"; @@ -67,11 +67,7 @@ export const deleteSession = createAsyncThunk( dispatch(deleteSessionMetadata(id)); // optimistic const state = getState(); if (id === state.session.id) { - await dispatch( - loadLastSession({ - saveCurrentSession: false, - }), - ); + await dispatch(loadLastSession()); } const result = await extra.ideMessenger.request("history/delete", { id }); if (result.status === "error") { @@ -146,19 +142,9 @@ export const loadRemoteSession = createAsyncThunk< }, ); -export const loadLastSession = createAsyncThunk< - void, - { - saveCurrentSession: boolean; - }, - ThunkApiType ->( +export const loadLastSession = createAsyncThunk( "session/loadLast", - async ({ saveCurrentSession }, { extra, dispatch, getState }) => { - const state = getState(); - - if (state.session.id && saveCurrentSession) { - } + async (_, { extra, dispatch, getState }) => { const lastSessionId = getState().session.lastSessionId; if (!lastSessionId) {