Vue 3.5 $watch doesn't return a function during SSR #11924
Labels
❗ p4-important
Priority 4: this fixes bugs that violate documented behavior, or significantly improves perf.
🐞 bug
Something isn't working
regression
Vue version
3.5.5
Link to minimal reproduction
This uses the Nuxt reproduction starter to quickly setup SSR:
https://stackblitz.com/edit/github-ltvjgn?file=app.vue
Steps to reproduce
What is expected?
A TypeError should not be thrown by calling unwatch.
$watch
is expected to return a function.What is actually happening?
The return value is an object, not a function. This is happening because
doWatch
returns an object, not a function during some SSR scenarios here: https://github.com/vuejs/core/blame/d0b513eb463f580e29378e43d112ff6859aa366e/packages/runtime-core/src/apiWatch.ts#L182-L186.System Info
Any additional comments?
This was detected in a Nuxt 3 app that uses
@vue/apollo-option
. That package calls unwatch during SSR. I filed a bug in that project to document the issue. vuejs/apollo#1575I have a fix with a unit test in progress, I'll open a PR soon (#11925).
The text was updated successfully, but these errors were encountered: