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

Allow late upgrading of bound elements #2653

Closed
kevinpschaaf opened this issue Oct 30, 2015 · 7 comments
Closed

Allow late upgrading of bound elements #2653

kevinpschaaf opened this issue Oct 30, 2015 · 7 comments
Assignees

Comments

@kevinpschaaf
Copy link
Member

Currently elements that are bound (i.e. have data pushed to them by their host) must be upgraded prior to data propagation. This is because the act of upgrading installs accessors on the element via its prototype, which may be shadowed by data values propagated to the instance earlier by the host.

This is typically not an issue when an element imports all of its dependencies before registering, which guarantees that when a host stamps its template, the children upgrade prior to the host pushing its data.

However, to support lazy upgrade use cases, elements would need to support reading instance values for properties with accessors, deleting the instance values, and passing them into the initial configuration / setters. This should likely be an option via an attribute (e.g. late-bind) so that all instances aren't taxed with this extra processing.

@kevinpschaaf kevinpschaaf self-assigned this Oct 30, 2015
@ebidel
Copy link
Contributor

ebidel commented Oct 30, 2015

+1. In 🎅's lazy loading system, we had to use getAttribute() to poke at values before elements were upgraded and bound.

@samccone
Copy link
Contributor

👍 oh this would be magical ✨

@robdodson
Copy link
Contributor

yeah very much want this!

@tpluscode
Copy link

👍

@srikkbhat
Copy link

+1.

Couple of observations. Reference plunker: http://plnkr.co/edit/4WEsWabS3nNSacyimwst

  1. The boolean property is pushed to lazy element - show-boolean.
  2. The value initialization of the property in lazy element is ignored - my-element-two.shared-value. This looks odd.

Update: After spending two more days on this, I found that the properties were updating from parent to lazy loaded element. However the local dom and child elements of the lazy loaded element were not getting the updated properties. I was able to resolve this by adding this.notifyPath to all the values pushed from parent to lazy loaded element in the attached callback of the lazy loaded element.

@TimvdLippe
Copy link
Contributor

When using async HTML imports I encountered this issue too. I have tried to dig into the code to develop a solution, but sadly it is not clear enough where the issue is and how it can be solved.

@kevinpschaaf
Copy link
Member Author

Essentially a dupe of #2348, which has been addressed in #3417.

fawkstrot pushed a commit to seiops/cranberry that referenced this issue May 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants