imported-template icon indicating copy to clipboard operation
imported-template copied to clipboard

Change lifecycle

Open tomalec opened this issue 9 years ago • 0 comments

Currently we do all the work (importing, fetching and stamping elements, attaching the model) on attachedCallback.

What if we:

  1. Import nodes on createdCallback and every content attributeChangeCallback even when detached
  2. Attach model on createdCallback, every model attributeChangeCallback, once new content is imported, before it's (re-)stamped.
  3. Attach nodes after element is atached
  4. Detach nodes once element is detached (keeping the reference)

@warpech @miyconst WDYT?

Benefits:

  • we could start importing content sooner => improve FOUC
  • we could access the imported content before stamping in more gently way (default layouts for juicy-composition)
  • we could easier move imported-template-scope magic to separate component, that will plug-in to this

Risks/Doubts:

  • imported elements will be created before attached to main document, so if they well created with such assumption they mail fail (however it is a bad practice anyway)
  • flow may seem more tangled (however, I believe that with proper explanation in may be easy to get)

tomalec avatar Jul 04 '16 13:07 tomalec