Fix session cancel and new task routing
This commit is contained in:
@@ -255,12 +255,15 @@ function AssistantWorkspace() {
|
||||
setActiveSessionId(next);
|
||||
};
|
||||
const handleChanged = (event: Event) => {
|
||||
const detail = (event as CustomEvent<{ sessionId?: string | null }>)
|
||||
.detail;
|
||||
const next =
|
||||
detail?.sessionId ?? readSessionIdFromUrl() ?? readActiveSessionId();
|
||||
const customEvent = event as CustomEvent<{ sessionId?: string | null }>;
|
||||
const hasExplicitSession =
|
||||
customEvent.detail &&
|
||||
Object.prototype.hasOwnProperty.call(customEvent.detail, "sessionId");
|
||||
const next = hasExplicitSession
|
||||
? (customEvent.detail.sessionId ?? null)
|
||||
: (readSessionIdFromUrl() ?? readActiveSessionId());
|
||||
console.log("[active-session] event-changed", {
|
||||
detailSessionId: detail?.sessionId,
|
||||
detailSessionId: customEvent.detail?.sessionId,
|
||||
next,
|
||||
});
|
||||
setActiveSessionId(next);
|
||||
|
||||
@@ -131,8 +131,8 @@ const ThreadListNew: FC = () => {
|
||||
variant="outline"
|
||||
className="aui-thread-list-new h-9 w-full justify-start gap-2 rounded-lg px-3 text-sm hover:bg-muted data-active:bg-muted"
|
||||
onClick={() => {
|
||||
clearActiveSessionId();
|
||||
pushHomeUrl();
|
||||
clearActiveSessionId();
|
||||
clearSession();
|
||||
window.dispatchEvent(new Event("claw-active-session-cleared"));
|
||||
}}
|
||||
|
||||
@@ -203,8 +203,8 @@ function CollapsedSidebarRail({
|
||||
<CollapsedIconButton
|
||||
label="新任务"
|
||||
onClick={() => {
|
||||
clearActiveSessionId();
|
||||
pushHomeUrl();
|
||||
clearActiveSessionId();
|
||||
clearSession();
|
||||
window.dispatchEvent(new Event("claw-active-session-cleared"));
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user