From 173bdeb18a51070b4bc32910d93117f3ff2e765c Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Tue, 15 Aug 2023 11:29:22 +0200 Subject: [PATCH] refactor: run nested scopes within pinia --- packages/pinia/src/store.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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) { -- 2.47.2