Skip to content

Commit 792fc24

Browse files
committed
fix(warn): avoid toRefs warning for Vue 2
Fix #648 If this PR vuejs/composition-api#821 gets fixed, this commit can be reverted
1 parent 9480474 commit 792fc24

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/pinia/src/store.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ function createSetupStore<
221221
let debuggerEvents: DebuggerEvent[] | DebuggerEvent
222222
const initialState = pinia.state.value[$id] as UnwrapRef<S> | undefined
223223

224-
if (!initialState && (!__DEV__ || !hot)) {
224+
// avoid setting the state for option stores are it is set
225+
// by the setup
226+
if (!buildState && !initialState && (!__DEV__ || !hot)) {
225227
if (isVue2) {
226228
set(pinia.state.value, $id, {})
227229
} else {

0 commit comments

Comments
 (0)