From: Eduardo San Martin Morote Date: Tue, 15 Aug 2023 09:29:22 +0000 (+0200) Subject: refactor: run nested scopes within pinia X-Git-Tag: @pinia/nuxt@0.5.0~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=173bdeb18a51070b4bc32910d93117f3ff2e765c;p=thirdparty%2Fvuejs%2Fpinia.git refactor: run nested scopes within pinia --- diff --git a/packages/pinia/src/store.ts b/packages/pinia/src/store.ts index 3faa689a..a540e1d9 100644 --- a/packages/pinia/src/store.ts +++ b/packages/pinia/src/store.ts @@ -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) {