From 466555f9b6de58a34df901073d35a292edc1d8ef Mon Sep 17 00:00:00 2001 From: AtNes Date: Fri, 4 Jun 2021 19:24:24 -0700 Subject: [PATCH] Duplicating children fix for {shadow: false} When shadowDOM is not attached and developer wants to render children inside react component it will lead to duplicating of children. 1) Children will be placed at slot as intended 2) Children will remain at the and of the node, because after rendering original content won't be cleared --- src/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.js b/src/index.js index 42318d7..3e689ad 100644 --- a/src/index.js +++ b/src/index.js @@ -81,6 +81,9 @@ function connectedCallback() { { ...this._props, context }, toVdom(this, this._vdomComponent) ); + + // rendering to clear node + this.innerHTML = ""; (this.hasAttribute('hydrate') ? hydrate : render)(this._vdom, this._root); }