Fix active session replay state
This commit is contained in:
@@ -19,6 +19,11 @@ import {
|
||||
useState,
|
||||
} from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
clearActiveSessionId,
|
||||
readActiveSessionId,
|
||||
writeActiveSessionId,
|
||||
} from "@/lib/claw-active-session";
|
||||
import { useClawSessionReplay } from "@/lib/claw-session-replay";
|
||||
|
||||
type ClawSession = {
|
||||
@@ -106,7 +111,7 @@ const ThreadListNew: FC = () => {
|
||||
return (
|
||||
<div
|
||||
onClickCapture={() => {
|
||||
window.localStorage.removeItem("claw.activeSessionId");
|
||||
clearActiveSessionId();
|
||||
window.dispatchEvent(new Event("claw-active-session-cleared"));
|
||||
}}
|
||||
>
|
||||
@@ -141,7 +146,7 @@ const ClawSessionList: FC = () => {
|
||||
const renameInputRef = useRef<HTMLInputElement | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
setActiveSessionId(window.localStorage.getItem("claw.activeSessionId"));
|
||||
setActiveSessionId(readActiveSessionId());
|
||||
const refreshSessions = () => {
|
||||
fetch("/api/claw/sessions")
|
||||
.then((res) => (res.ok ? res.json() : []))
|
||||
@@ -247,10 +252,7 @@ const ClawSessionList: FC = () => {
|
||||
className="aui-thread-list-item-trigger flex h-full min-w-0 flex-1 items-center truncate px-3 text-start text-sm"
|
||||
onClick={async () => {
|
||||
setOpenMenuSessionId(null);
|
||||
window.localStorage.setItem(
|
||||
"claw.activeSessionId",
|
||||
session.session_id,
|
||||
);
|
||||
writeActiveSessionId(session.session_id);
|
||||
setActiveSessionId(session.session_id);
|
||||
setLoadingSessionId(session.session_id);
|
||||
try {
|
||||
@@ -333,9 +335,7 @@ const ClawSessionList: FC = () => {
|
||||
);
|
||||
setOpenMenuSessionId(null);
|
||||
if (activeSessionId === session.session_id) {
|
||||
window.localStorage.removeItem(
|
||||
"claw.activeSessionId",
|
||||
);
|
||||
clearActiveSessionId();
|
||||
setActiveSessionId(null);
|
||||
window.dispatchEvent(
|
||||
new Event("claw-active-session-cleared"),
|
||||
|
||||
Reference in New Issue
Block a user