-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Observers executed twice if defined in both the properties and the observers array #1884
Comments
All three are by design.
This is the reason that multiple-property observers exist at all-- so you can disambiguate when you want the observer called for each individual property change and when you want the observer to require all properties defined. You must always declare the properties your observer depends on (access in the function), and so if your observer accesses more than one property, you should use a multi-property observer in the |
Thank you for the clarification. But in the example in 1 there are not multiple observers for the same property. http://jsbin.com/hoginazatu/1/edit?html,console,output Should It be allowed? Well it is an special case in which the multiple-property observer only contains one property. |
If you want observer to be called only once, then why not define either in property or observer section, what is the need to define twice. Is there any special need to define twice. I am facing similar issue even though I have defined only in observer section, in case of route.path property of app-router. |
I reproduced this with this example:
http://jsbin.com/hoginazatu/1/edit?html,console,output
In this case the same observer is binded twice with the same variable, once in the properties and once in the observers array, resulting in the observer executed twice when there is only one change.
Also, I see a problem in this example:
http://jsbin.com/zepabasuge/1/edit?html,console,output
In this case two different variables are binded to the same observer, the two change, triggering two executions of the observer, the system should be intelligent enough to just call the observer once, after the update of both variables, like it happens in the following example:
http://jsbin.com/cihobeliju/1/edit?html,console,output
Is this correct or some setup would need this kind of behaviour?
The text was updated successfully, but these errors were encountered: