Navigation Menu

Skip to content

Commit

Permalink
fix(watch): only trigger warning in the dev environment (#754)
Browse files Browse the repository at this point in the history
Co-authored-by: webfansplz <>
  • Loading branch information
webfansplz committed Jul 8, 2021
1 parent f0e423f commit 0fe0088
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/apis/watch.ts
Expand Up @@ -298,23 +298,25 @@ function createWatcher(
} else if (isFunction(s)) {
return s()
} else {
warn(
`Invalid watch source: ${JSON.stringify(s)}.
__DEV__ &&
warn(
`Invalid watch source: ${JSON.stringify(s)}.
A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`,
vm
)
vm
)
return noopFn
}
})
} else if (isFunction(source)) {
getter = source as () => any
} else {
getter = noopFn
warn(
`Invalid watch source: ${JSON.stringify(source)}.
__DEV__ &&
warn(
`Invalid watch source: ${JSON.stringify(source)}.
A watch source can only be a getter/effect function, a ref, a reactive object, or an array of these types.`,
vm
)
vm
)
}

const applyCb = (n: any, o: any) => {
Expand Down

0 comments on commit 0fe0088

Please sign in to comment.