You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I accidentally stumbled upon this scenario just now. If appended to the DOM multiple times before performeUpdate() has been able to execute, createRenderRoot() will be called each time. This may be unexpected behavior for subclasses overriding createRenderRoot(). An effect of this is when adoptable stylesheets are not supported the style tags are also duplicated multiple times (otherwise the stylesheets are readopted).
I would assume this is unwanted behavior and is probably a vestigial check from a time when createRenderRoot() and firstUpdated(changed)/_$didUpdate(changed) may have had different tasks to perform.
I propose changing the condition from !this.hasUpdated to !this.renderRoot. I am open to creating a PR for this (or for any other solution that the maintainers may prefer).
The text was updated successfully, but these errors were encountered:
Thanks for reporting this. This is just an oversight and and obvious bug. It should be a simple fix, thanks for the PR offer but we should be able to handle this quickly.
I accidentally stumbled upon this scenario just now. If appended to the DOM multiple times before
performeUpdate()
has been able to execute,createRenderRoot()
will be called each time. This may be unexpected behavior for subclasses overridingcreateRenderRoot()
. An effect of this is when adoptable stylesheets are not supported the style tags are also duplicated multiple times (otherwise the stylesheets are readopted).I would assume this is unwanted behavior and is probably a vestigial check from a time when
createRenderRoot()
andfirstUpdated(changed)
/_$didUpdate(changed)
may have had different tasks to perform.https://github.com/Polymer/lit-html/blob/f0d683b071aad02c423e45ea0d3db8816259759b/packages/reactive-element/src/reactive-element.ts#L735-L739
I propose changing the condition from
!this.hasUpdated
to!this.renderRoot
. I am open to creating a PR for this (or for any other solution that the maintainers may prefer).The text was updated successfully, but these errors were encountered: