From: Eduardo San Martin Morote Date: Wed, 8 Sep 2021 14:42:14 +0000 (+0200) Subject: fix: correct store in getters vue 2 X-Git-Tag: pinia@2.0.0-rc.9~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3d4080b503292f1d711daa51fad204c5f8db223d;p=thirdparty%2Fvuejs%2Fpinia.git fix: correct store in getters vue 2 --- diff --git a/packages/pinia/src/store.ts b/packages/pinia/src/store.ts index 690bad22..e695d85e 100644 --- a/packages/pinia/src/store.ts +++ b/packages/pinia/src/store.ts @@ -127,10 +127,12 @@ function createOptionsStore< computedGetters[name] = markRaw( computed(() => { setActivePinia(pinia) - // const context = store || ref(localState).value + // it was created just before + const store = pinia._s.get(id)! // @ts-expect-error // return getters![name].call(context, context) - return store && getters![name].call(store, store) + // TODO: avoid reading the getter while assigning with a global variable + return getters![name].call(store, store) }) ) return computedGetters