Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(watch): only trigger warning in the dev environment #754

Merged
merged 1 commit into from Jul 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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