-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
watch()
not triggered when watching component props and mutating nested reactive object
#9965
Comments
I'm not sure if I understand the issue. When you watch a ref without The docs mention only one specific case where we do a deep watch by default, and what's when watching a The note at the end about |
@LinusBorg Oops sorry, I've been too quick when analyzing the issue. So i think the issue is probably when passing down an object Ref to a component which watch its own props Should we close this one and open another issue ? |
Don't think we need a new issue. Thanks for the new playground. The issue here is that This is indeed a change, caused by a fix for #9916 (PR: #9928) watching a shallow object should only traverse the first level of properties, but previously it did a deep traverse and unexpectedly also collected nested reactive data as dependencies. The current behavior is more in line with how watch should work in our understanding, and the change in #9928 is thus considered a fix. But I can see how it's kind of a breaking change for code that previously relied on the previous behavior, especially watching |
watch()
not triggered on deep assignment for a ref with an objectwatch()
not triggered when watching component props
watch()
not triggered when watching component propswatch()
not triggered when watching component props and mutating nested reactive object
Vue version
3.4.2 - 3.4.3 - latest (local 24d77c2)
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-rtqam5?file=package.json,src%2Fcomponents%2FHelloWorld.vue&terminal=devSteps to reproduce
click oncount is: { count: 0 }
see thread
What is expected?
What is actually happening?
System Info
No response
Any additional comments?
It seems like that watching
props
does not work either see the workaround therefix(nuxt): workaround deep watch due to vue 3.4.2 nuxt/nuxt#24986
cc @danielroe
The text was updated successfully, but these errors were encountered: