From ef7e2fc450250bb13f21ac10c0076b8fdcf32b98 Mon Sep 17 00:00:00 2001 From: Ben Bucksch <1907525+benbucksch@users.noreply.github.com> Date: Thu, 12 Jan 2023 06:44:05 +0100 Subject: [PATCH] Prevent error entirely Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com> --- src/runtime/store/index.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/runtime/store/index.ts b/src/runtime/store/index.ts index 1b2481e572..8b89ac27de 100644 --- a/src/runtime/store/index.ts +++ b/src/runtime/store/index.ts @@ -99,11 +99,8 @@ export function writable(value?: T, start: StartStopNotifier = noop): Writ return () => { subscribers.delete(subscriber); if (subscribers.size === 0) { - if (stop === null) { - throw new Error('unsubscribe cannot be called twice'); - } stop(); - stop = null; + stop = noop; } }; }