Errors in computed
bypass onErrorCaptured
#11624
Labels
🔨 p3-minor-bug
Priority 3: this fixes a bug, but is an edge case that only affects very specific usage.
Vue version
3.4.38
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-kwgofp?file=src%2Fcomponents%2FNotCaptured.vue
Steps to reproduce
Preparations: Open the browser console
What is expected?
The same as when clicking 'Throw captured':
What is actually happening?
System Info
No response
Any additional comments?
Basic analysis
In our Nuxt application I was able to reproduce the error without using
watch
and instead by using the computed property directly in a template. After updating this was no longer possible and I was able to pinpoint this to version 3.4.32 and most likely the changes in ee0248aIt seems that the changes made it so, that the Scheduler flushJobs function now passes the instance from the jobs, which creates the desired behavior in the handleError function. But the jobs created for the
watch
keys seem to be missing that instance.How did we run into the bug?
We have a Nuxt application and are using TanStack Query. For most API requests we need some information from the current URL that needs to be validated against our session (also coming from the API). This means in the example below
role
starts asundefined
and then either switches to a valid role or throws, so our ErrorBoundary component can handle it. But because TanStack is using Vue'swatch
under the hood for the queryKey, we are running into this issue.The text was updated successfully, but these errors were encountered: