Skip to content

Commit

Permalink
fix(warn): avoid toRefs warning for Vue 2
Browse files Browse the repository at this point in the history
Fix #648

If this PR vuejs/composition-api#821 gets fixed, this commit can be reverted
  • Loading branch information
jason-repos committed Oct 3, 2021
1 parent ef777f4 commit bcd4fa3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/pinia/src/store.ts
Expand Up @@ -221,7 +221,9 @@ function createSetupStore<
let debuggerEvents: DebuggerEvent[] | DebuggerEvent
const initialState = pinia.state.value[$id] as UnwrapRef<S> | 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 {
Expand Down

0 comments on commit bcd4fa3

Please sign in to comment.