Currently when a custom element's onConnected callback is invoked, we're clearing the innerHTML to avoid it interfering with the (p)react component's render structure. If a component is then moved in the DOM, it will trigger the custom elements lifecycle methods again, this time however, there is no nested HTML to assign to this.props.children, so it's undefined on the subsequent render.
The changes in this PR first checks for an assigned value for this.props.children, and makes use of that if already defined, caching the result from the previous render.
Currently when a custom element's
onConnected
callback is invoked, we're clearing theinnerHTML
to avoid it interfering with the (p)react component's render structure. If a component is then moved in the DOM, it will trigger the custom elements lifecycle methods again, this time however, there is no nested HTML to assign tothis.props.children
, so it's undefined on the subsequent render.The changes in this PR first checks for an assigned value for
this.props.children
, and makes use of that if already defined, caching the result from the previous render.