-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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 being fired for a different property when the value is changed #4090
Comments
The same with #4060 . When re-render, the default function of nuts returns an object literal {}. |
Hi I don't think the two issues are the same as I am not changing the 'nuts' property and the watch is still being fired. |
@doonetheprune , your nuts prop default function will return a fresh object {} each time, {} !== {}, it's changed internally. |
@defcc I agree the default function should return a fresh object however I don't think it should return a new object every time the value property is changed, it should only do it when the component is created. If you look at fiddle the nuts property should not be affected by the value property. Please could you reopen as this is not the same as #4060? |
This is caused by the vue2 render system. I add a updated function to your demo for a better understanding. https://jsfiddle.net/rdjjpc7a/92/ |
@defcc how come then if the nuts property is a string why is the watch not fired? |
explained here , you could take a look. |
@defcc I have looked at the fiddle in #4060 and can see why they are similar and the underlying issue might be the same. This issue however highlights the problem in a scenario that is a lot more likely to occur. Also reading the comments from @yyx990803 on issue #4060 it makes me really worried you dont plan on fixing this issue. Without trying to be to harsh on vue which I think is great, a basic bug like this means it looses a lot of credibility. If I came across this when I first started using vue I would have stopped using it. |
Hi
I have come across a strange issue where the watch for a property is called when the property has a default value of an empty object and the value property is changed. If that makes no sense, I have created a js fiddle to demonstrate it.
https://jsfiddle.net/rdjjpc7a/90/
The text was updated successfully, but these errors were encountered: