Skip to content

Conversation

@t-soares
Copy link

Fixes #592

The update method is responsible to reflect property changes to attributes. Changing a property that has reflect equals true will populate the _reflectingProperties to indicate that the changed property must be reflected to its attribute.

There is a logic that prevents the property being changed from being added to the _reflectingProperties, if the property change was caused by an attribute change.

There is also the _changedProperties map that contains the keys for any properties that have changed since the last update cycle.

If the the same property is changed multiple times on the same update cycle, of course its key is added just once _changedProperties map.

The problem occurs when you change an attribute and on the sae update cycle change the property. In this scenario, when you change the attribute then the property is not added to the _reflectingProperties map. iI after changing the attribute, you change the property then the property is already on the _changedProperties map and the logic that adds the property to the _reflectingProperties is not executed in this case.

This leads to the update method to not reflect the property change to the attribute.

I changed the updating-element.ts code to add to the _reflectingProperties map when the property is changed, even if the property is already on the _changedProperties map. Also if the property change come from an attribute change I remove the property from the _reflectingProperties map.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@sorvell
Copy link
Member

sorvell commented Mar 12, 2019

Thanks for the PR. I didn't notice it before doing #610 which is almost exactly the same. Closing this in favor of #610, but thanks again.

@sorvell sorvell closed this Mar 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants