]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
fix: avoid watchers to trigger while building the store
authorEduardo San Martin Morote <posva13@gmail.com>
Sun, 11 Jul 2021 18:40:30 +0000 (20:40 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 19 Jul 2021 09:51:12 +0000 (11:51 +0200)
src/store.ts

index 4ff234c404fee6aacc2fff70512f8a56832aeed0..fea344bc322f8a3d6bea612e7e929dc2c4dc4245 100644 (file)
@@ -156,7 +156,7 @@ function createSetupStore<
   }
 
   // internal state
-  let isListening = true
+  let isListening = false // set to true at the end
   let subscriptions: SubscriptionCallback<S>[] = markRaw([])
   let actionSubscriptions: StoreOnActionListener<Id, S, G, A>[] = markRaw([])
   let debuggerEvents: DebuggerEvent[] | DebuggerEvent
@@ -419,6 +419,7 @@ function createSetupStore<
     ;(options.hydrate || innerPatch)(store, initialState)
   }
 
+  isListening = true
   return store
 }