-
-
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
feat(apiWatch): support passing the number
type for deep
to control the watch depth
#9572
Conversation
Size ReportBundles
Usages
|
9320020
to
1741978
Compare
Now have some conflicts after #9928 Also, I think it might be more concise to simply allow passing a number to // infinite depth
watch(src, () => {}, { deep: true })
// explicit depth
watch(src, () => {}, { deep: 1 }) |
Due to the consideration that users might have previously passed "deep" as a number in their usage, which was mistakenly treated as true in the previous implementation, if we now interpret "deep number" as referring to depth, the earlier practice of passing "deep" as a number would result in inconsistency. Of course, such usage was incorrect in the past. Should we take this into account? If we choose not to consider this, recognizing "deep" as referring to depth would be a more reasonable design approach. |
That's a good point. I think we can add a warning in a 3.4 patch that checks for |
Agreed. It's a good plan. |
This feature is very useful for me. awesome! |
number
type for deep
to control the watch depth
I don't want to annoy you guys, but I'm curious, since 3.5 already has some alpha releases.. is there still a chance this goes into 3.5? I'd love to use this feature 😀 |
RFC: vuejs/rfcs#597
fixed #9916
Support passing
watch deep
option as a number type, indicating the depth to which the object should be monitored. This allows control over the depth of object access in thewatch
function. In scenarios with large datasets, this can significantly improve performance.