From c9c977bee13b156b4888a6b684ec364e1e63dd13 Mon Sep 17 00:00:00 2001 From: hypercross Date: Mon, 13 Jul 2026 00:54:20 +0800 Subject: [PATCH] refactor: remove unused unsubscribe function from journalStream --- src/components/stores/journalStream.ts | 4 ++-- src/workers/journal.worker.ts | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/components/stores/journalStream.ts b/src/components/stores/journalStream.ts index e02ca0e..aeba43b 100644 --- a/src/components/stores/journalStream.ts +++ b/src/components/stores/journalStream.ts @@ -60,7 +60,7 @@ export type { SessionManifest } from "../../workers/journal.worker"; // --------------------------------------------------------------------------- let _workerAPI: Comlink.Remote | null = null; -let _unsubscribe: (() => void) | null = null; + function getWorkerAPI(): Comlink.Remote { if (!_workerAPI) { @@ -226,7 +226,7 @@ async function ensureSubscribed(): Promise { _subscribed = true; const api = getWorkerAPI(); - _unsubscribe = await api.subscribe( + await api.subscribe( Comlink.proxy((patch: WorkerPatch) => { handlePatch(patch); }), diff --git a/src/workers/journal.worker.ts b/src/workers/journal.worker.ts index 126afa3..cba9572 100644 --- a/src/workers/journal.worker.ts +++ b/src/workers/journal.worker.ts @@ -496,7 +496,7 @@ const api = { }, /** Register a callback for state patches. Sends full state immediately. */ - subscribe(callback: Comlink.ProxyOrClone): () => void { + subscribe(callback: Comlink.ProxyOrClone): void { const cb = callback as PatchCallback; subscribers.add(cb); // Send initial full state @@ -513,9 +513,6 @@ const api = { } catch { // ignore } - return () => { - subscribers.delete(cb); - }; }, };