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

TypeError unwatch is not a function, Vue 3.5.5 regression #1575

Closed
deleteme opened this issue Sep 13, 2024 · 1 comment
Closed

TypeError unwatch is not a function, Vue 3.5.5 regression #1575

deleteme opened this issue Sep 13, 2024 · 1 comment

Comments

@deleteme
Copy link
Contributor

Describe the bug

The @vue/apollo-option package calls the unwatch function, returned by the Vue instance $watch API.

at SmartQuery.stop (./node_modules/@vue/apollo-option/dist/vue-apollo-option.esm.mjs:574:9)
at SmartQuery.stop (./node_modules/@vue/apollo-option/dist/vue-apollo-option.esm.mjs:743:65)
at SmartQuery.destroy (./node_modules/@vue/apollo-option/dist/vue-apollo-option.esm.mjs:656:12)
at SmartQuery.destroy (./node_modules/@vue/apollo-option/dist/vue-apollo-option.esm.mjs:1035:68)
at DollarApollo.destroy (./node_modules/@vue/apollo-option/dist/vue-apollo-option.esm.mjs:1344:27)
at Proxy.destroy (./node_modules/@vue/apollo-option/dist/vue-apollo-option.esm.mjs:1431:18)
at ./node_modules/@vue/apollo-option/dist/vue-apollo-option.esm.mjs:1487:19
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

In Vue 3.5.0 through 3.5.5, during some SSR scenarios, unwatch is currently not always a function. Instead, it's an object. @vue/apollo-option attempts to call it, and is throwing the TypeError above, resulting in a 500 response.

To Reproduce

I don't have a reproduction available, but if you have an SSR'd apollo option query, you should see the TypeError.

Expected behavior

The TypeError should not be thrown.

Versions
vue: 3.5.0 through 3.5.5
vue-apollo: 4.2.0
@apollo/client: 3.10.6

Additional context

I believe this to be a Vue core regression in the 3.5 reactivity refactoring here https://github.com/vuejs/core/blame/d0b513eb463f580e29378e43d112ff6859aa366e/packages/runtime-core/src/apiWatch.ts#L182-L186. I have a vue core fix in the works here and will open a PR soon.

I'm filing this issue to log the error for the benefit of anyone else who experiences this error.

Regarding the @vue/apollo-option unwatch calls in Vue 3.5, they appear to be implemented as no-op functions, and so maybe it's not necessary for @vue/apollo-option to call them anymore.

@deleteme
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant