From: Eduardo San Martin Morote Date: Sun, 3 Oct 2021 09:48:05 +0000 (+0200) Subject: fix(warn): avoid toRefs warning for Vue 2 X-Git-Tag: @pinia/nuxt@0.0.3~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c174fe1dfa48569b1fc9e04f105832ab9a8e3824;p=thirdparty%2Fvuejs%2Fpinia.git fix(warn): avoid toRefs warning for Vue 2 Fix #648 If this PR https://github.com/vuejs/composition-api/pull/821 gets fixed, this commit can be reverted --- diff --git a/packages/pinia/src/store.ts b/packages/pinia/src/store.ts index c7467a6e..96b8465f 100644 --- a/packages/pinia/src/store.ts +++ b/packages/pinia/src/store.ts @@ -221,7 +221,9 @@ function createSetupStore< let debuggerEvents: DebuggerEvent[] | DebuggerEvent const initialState = pinia.state.value[$id] as UnwrapRef | undefined - if (!initialState && (!__DEV__ || !hot)) { + // avoid setting the state for option stores are it is set + // by the setup + if (!buildState && !initialState && (!__DEV__ || !hot)) { if (isVue2) { set(pinia.state.value, $id, {}) } else {