]> git.ipfire.org Git - thirdparty/vuejs/pinia.git/commitdiff
refactor: run nested scopes within pinia
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 15 Aug 2023 09:29:22 +0000 (11:29 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 15 Aug 2023 09:29:25 +0000 (11:29 +0200)
packages/pinia/src/store.ts

index 3faa689aa8bafbb0b21233055aa2d09ad59c6ced..a540e1d973eeb7efe17f3e7fbdb31f6d0605c8cc 100644 (file)
@@ -479,10 +479,9 @@ function createSetupStore<
     (pinia._a && pinia._a.runWithContext) || fallbackRunWithContext
 
   // TODO: idea create skipSerialize that marks properties as non serializable and they are skipped
-  const setupStore = pinia._e.run(() => {
-    scope = effectScope()
-    return runWithContext(() => scope.run(setup))
-  })!
+  const setupStore = runWithContext(() =>
+    pinia._e.run(() => (scope = effectScope()).run(setup)!)
+  )!
 
   // overwrite existing actions to support $onAction
   for (const key in setupStore) {