From b718c8e0b53f44891b98c174f3f235895420bca1 Mon Sep 17 00:00:00 2001 From: pushkin Date: Mon, 13 Apr 2020 17:47:42 +0200 Subject: [PATCH] Update index.ts --- src/runtime/store/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/store/index.ts b/src/runtime/store/index.ts index aa04ff86ca..8ac0d4203c 100644 --- a/src/runtime/store/index.ts +++ b/src/runtime/store/index.ts @@ -90,8 +90,8 @@ export function writable(value: T, start: StartStopNotifier = noop): Writa invalidate: Invalidator = noop ): Unsubscriber { const subscriber: SubscribeInvalidateTuple = [run, invalidate]; - if (!subscribers.length) stop = start(set) || noop; subscribers.push(subscriber); + if (subscribers.length === 1) stop = start(set) || noop; run(value); return () => { const index = subscribers.indexOf(subscriber);