Skip to content
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(fast-element): preserve observable values from before upgrade #2889

Conversation

EisenbergEffect
Copy link
Contributor

Description

Motivation & context

When observable property values are set through the template engine, this happens before the elements have been upgraded. As a result, the property values shadow the observable property getter/setter, preventing observation. Additionally, if the element initialized the properties to a starting value, the initializers will overwrite the values provided by the template engine.

This PR captures values set by the template engine, deletes the shadowing properties, and then re-applies the bound values during the connect lifecycle.

Issue type checklist

  • Chore: A change that does not impact distributed packages.
  • Bug fix: A change that fixes an issue, link to the issue above.
  • New feature: A change that adds functionality.

As part of the fix, a new API was added to enable getting a list of all observed properties for an object. The naming observedProperties was chosen to mirror the web components naming of observedAttributes.

Process & policy checklist

  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

@EisenbergEffect EisenbergEffect merged commit d84884a into master Apr 6, 2020
@EisenbergEffect EisenbergEffect deleted the users/eisenbergeffect/observable-values-element-upgrade-fix branch April 6, 2020 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants