Fix active session replay state
This commit is contained in:
@@ -37,6 +37,10 @@ import {
|
||||
CollapsibleContent,
|
||||
CollapsibleTrigger,
|
||||
} from "@/components/ui/collapsible";
|
||||
import {
|
||||
readActiveSessionId,
|
||||
writeActiveSessionId,
|
||||
} from "@/lib/claw-active-session";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type ActivityContextValue = {
|
||||
@@ -71,12 +75,7 @@ export function ActivityProvider({ children }: { children: ReactNode }) {
|
||||
}, []);
|
||||
const openFiles = useCallback((nextSessionId?: string | null) => {
|
||||
setMode("files");
|
||||
setSessionId(
|
||||
nextSessionId ??
|
||||
(typeof window !== "undefined"
|
||||
? window.localStorage.getItem("claw.activeSessionId")
|
||||
: null),
|
||||
);
|
||||
setSessionId(nextSessionId ?? readActiveSessionId());
|
||||
setFilesRefreshToken((value) => value + 1);
|
||||
setOpen(true);
|
||||
}, []);
|
||||
@@ -257,7 +256,7 @@ function SessionFilesPanel({
|
||||
let cancelled = false;
|
||||
async function loadFiles() {
|
||||
const activeSessionId = normalizeSessionId(
|
||||
sessionId ?? window.localStorage.getItem("claw.activeSessionId"),
|
||||
sessionId ?? readActiveSessionId(),
|
||||
);
|
||||
setStatus("正在读取聊天中的文件...");
|
||||
try {
|
||||
@@ -285,10 +284,7 @@ function SessionFilesPanel({
|
||||
return;
|
||||
}
|
||||
if (nextPayload.session_id) {
|
||||
window.localStorage.setItem(
|
||||
"claw.activeSessionId",
|
||||
nextPayload.session_id,
|
||||
);
|
||||
writeActiveSessionId(nextPayload.session_id);
|
||||
}
|
||||
setPayload(nextPayload);
|
||||
setStatus("");
|
||||
|
||||
Reference in New Issue
Block a user