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); - }; }, };