mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 13:10:43 +00:00
fix(clawsweeper): address review for automerge-openclaw-openclaw-76021 (1)
This commit is contained in:
@@ -34,6 +34,8 @@ describe("handleDisconnected", () => {
|
||||
});
|
||||
const removeSpy = vi.spyOn(window, "removeEventListener").mockImplementation(() => undefined);
|
||||
const host = createHost();
|
||||
const cancelChatDictation = vi.fn();
|
||||
Object.assign(host, { cancelChatDictation });
|
||||
const disconnectSpy = (
|
||||
host.topbarObserver as unknown as { disconnect: ReturnType<typeof vi.fn> }
|
||||
).disconnect;
|
||||
@@ -42,6 +44,7 @@ describe("handleDisconnected", () => {
|
||||
|
||||
expect(removeSpy).toHaveBeenCalledWith("popstate", host.popStateHandler);
|
||||
expect(host.connectGeneration).toBe(1);
|
||||
expect(cancelChatDictation).toHaveBeenCalledTimes(1);
|
||||
expect(host.client).toBeNull();
|
||||
expect(host.connected).toBe(false);
|
||||
expect(disconnectSpy).toHaveBeenCalledTimes(1);
|
||||
|
||||
@@ -41,9 +41,7 @@ type LifecycleHost = {
|
||||
realtimeTalkStatus?: string;
|
||||
realtimeTalkDetail?: string | null;
|
||||
realtimeTalkTranscript?: string | null;
|
||||
chatDictationRecorder?: { stop: () => void; state?: string } | null;
|
||||
chatDictationStatus?: string;
|
||||
chatDictationDetail?: string | null;
|
||||
cancelChatDictation?: () => void;
|
||||
chatLoading: boolean;
|
||||
chatMessages: unknown[];
|
||||
chatToolMessages: unknown[];
|
||||
@@ -94,12 +92,7 @@ export function handleDisconnected(host: LifecycleHost) {
|
||||
host.realtimeTalkStatus = "idle";
|
||||
host.realtimeTalkDetail = null;
|
||||
host.realtimeTalkTranscript = null;
|
||||
if (host.chatDictationRecorder?.state === "recording") {
|
||||
host.chatDictationRecorder.stop();
|
||||
}
|
||||
host.chatDictationRecorder = null;
|
||||
host.chatDictationStatus = "idle";
|
||||
host.chatDictationDetail = null;
|
||||
host.cancelChatDictation?.();
|
||||
host.client?.stop();
|
||||
host.client = null;
|
||||
host.connected = false;
|
||||
|
||||
@@ -652,7 +652,6 @@ export class OpenClawApp extends LitElement {
|
||||
document.removeEventListener("keydown", this.chatMobileControlsKeydownHandler);
|
||||
document.removeEventListener("pointerdown", this.chatMobileControlsPointerdownHandler);
|
||||
this.chatMobileControlsTrigger = null;
|
||||
this.cancelChatDictation();
|
||||
handleDisconnected(this as unknown as Parameters<typeof handleDisconnected>[0]);
|
||||
super.disconnectedCallback();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user