Skip to content

An open source alternative to Tableau. Embeddable visual analytic

fix(): shadow root not removed after unmount

kyusho2f69fcdd57d0
diff --git a/packages/graphic-walker/src/index.tsx b/packages/graphic-walker/src/index.tsx
index fa47e7d6..4feae83f 100644
--- a/packages/graphic-walker/src/index.tsx
+++ b/packages/graphic-walker/src/index.tsx
@@ -37,7 +37,11 @@ export const GraphicWalker: React.FC<EditorProps> = props => {
), root);
shadowRoot.appendChild(root);
return () => {
- shadowRoot.innerHTML = '';
+ for (const node of shadowRoot.children) {
+ node.remove();
+ }
+ // @see https://stackoverflow.com/questions/20090059/how-to-remove-a-shadow-root-from-an-html-element-adorned-with-a-shadow-dom-from/57583697#57583697
+ container.outerHTML = container.outerHTML;
DOM.setBody(document.body);
DOM.setHead(document.head);
};