-
-
Notifications
You must be signed in to change notification settings - Fork 8k
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): control watch observation depth #9572
base: minor
Are you sure you want to change the base?
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! |
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.