-
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 called multiple times in inheritance chain #5067
Comments
I use this pattern a lot in my codebase, and I was thinking how this could possibly not have caused any issues for me before. Then I realized that 2.4 just got released yesterday. After downgrading this issue no longer there, so it seems that this is a regression in the new PropertiesMixin. :( I couldn't get the jsbin pointing to the 2.3.1 working. |
I can confirm the issue, this is affecting us as well, especially by breaking observers used to set and then check some flags. See this build for I quickly investigated and was able to reproduce it locally: adding |
Thanks for reporting! Did quite some digging, but I was able to figure it out. Fix up at #5068 |
Thanks! |
Any updates on this? 2.4 is announced now, and this will affect most peoples codebases. |
@LarsDenBakker #5068 will be reviewed by @kevinpschaaf and @sorvell and hopefully merged today 🎉 |
When can we expect a 2.4.1? Checking so that I can plan accordingly for the release of our app. |
Description
I have two classes,
base-element
defines an observer andmy-element
extendsbase-element
with no own properties. Both are placed in the dom with the property set. The observer of justbase-element
is called once. The observer ofmy-element
(which was inherited frombase-element
) is called twice.http://jsbin.com/wimozeravo/1/edit?html,console,output
Adding an empty properties set to
my-element
makes the observer fire only once:http://jsbin.com/giniqeweco/1/edit?html,console,output
It seems that when a class in an inheritance chain defines a property observer, for each class in the inheritance chain that does not define a properties getter, the property observer is called once extra.
This can be illustrated with mixins (which are just classes).
Here there are two mixins and a class. The first mixin defines an observer and the others don't define any properties. The observer is fired thrice:
http://jsbin.com/hilularuce/1/edit?html,console,output
With empty properties it's fired once:
http://jsbin.com/domakayufu/1/edit?html,console,output
The text was updated successfully, but these errors were encountered: