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