-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
fix(runtime-core): watching multiple values - handle undefined
as initial values (fix: #5032)
#5033
Conversation
I ran into the exact same issue this PR is fixing. While investigationg the issue, in noticed that, in addition to the original issue, the wrong value is passed to Replacing It's a pretty minor issue, so I'm wondering whether this would warrant a separate PR or if you could simply include the fix in your PR. |
watch( | ||
[a, b], | ||
() => { | ||
called = true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test seems not testing the change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right , I'm only testing it's being called initially (which previously it wasn't) but I need to validate the arguments passed.
That actually made me find a part my fix did not cover - oldValue was not undefined when it should be.
❌ Deploy Preview for vuejs-coverage failed.
|
ant-design-vue fixed this vueComponent/ant-design-vue#6085 |
…nitial values (fix: vuejs#5032) (vuejs#5033)
…nitial values (fix: vuejs#5032) (vuejs#5033)
We currently have an empty array as the intial
oldValue
for a watcher that watches multiple values.This does fail for an edge case where we watch multiple values and all of them are initially undefined, and trigger the watcher immediately.
We can solve this by settting the initial
oldValue
to an array filled withINITIAL_WATCHER_VALUE
fix: #5032