fix: flush session persistence on chat unmount to prevent data loss on navigation
This commit is contained in:
@@ -10,7 +10,8 @@
|
|||||||
import { createSignal, Show, onMount, For, onCleanup, batch } from "solid-js";
|
import { createSignal, Show, onMount, For, onCleanup, batch } from "solid-js";
|
||||||
import toast from "solid-toast";
|
import toast from "solid-toast";
|
||||||
import { sessions, activeSessionId, setActiveSession } from "@/stores/session-state";
|
import { sessions, activeSessionId, setActiveSession } from "@/stores/session-state";
|
||||||
import { sendMessage, compactSession, updateSessionAgent, updateSessionModelForSession, forceReset, abortSession, loadMessages, fetchSessions } from "@/stores/session-actions";
|
import { loadMessages, fetchSessions, flushSessionPersistence } from "@/stores/sessions";
|
||||||
|
import { sendMessage, compactSession, updateSessionAgent, updateSessionModelForSession, forceReset, abortSession } from "@/stores/session-actions";
|
||||||
import { addTask, setActiveTask, archiveTask } from "@/stores/task-actions";
|
import { addTask, setActiveTask, archiveTask } from "@/stores/task-actions";
|
||||||
import { messageStoreBus } from "@/stores/message-v2/bus";
|
import { messageStoreBus } from "@/stores/message-v2/bus";
|
||||||
import { formatTokenTotal } from "@/lib/formatters";
|
import { formatTokenTotal } from "@/lib/formatters";
|
||||||
@@ -233,6 +234,8 @@ export default function MultiXV2(props: MultiXV2Props) {
|
|||||||
onCleanup(() => {
|
onCleanup(() => {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
scrollContainer?.removeEventListener('scroll', handleScroll);
|
scrollContainer?.removeEventListener('scroll', handleScroll);
|
||||||
|
// Ensure any pending task updates are saved immediately before we potentially reload them
|
||||||
|
flushSessionPersistence(props.instanceId);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user