From bcd4fa370abafb3417cf4c6cf98701c9a6f8acbc Mon Sep 17 00:00:00 2001 From: jason-repos Date: Sun, 3 Oct 2021 11:48:05 +0200 Subject: [PATCH] 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 --- packages/pinia/src/store.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/pinia/src/store.ts b/packages/pinia/src/store.ts index c7467a6..96b8465 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 {