Skip to content

Commit 8584867

Browse files
authored
fix(widget): prevent shadow root re-attachment error
2 parents a0690e7 + 09405c0 commit 8584867

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

widget/src/src/cap.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -656,8 +656,14 @@
656656

657657
async connectedCallback() {
658658
this.#host = this;
659-
this.#shadow = this.attachShadow({ mode: "open" });
660-
this.#div = document.createElement("div");
659+
660+
if (!this.shadowRoot) {
661+
this.#shadow = this.attachShadow({ mode: "open" });
662+
} else {
663+
this.#shadow = this.shadowRoot;
664+
}
665+
666+
if (!this.#div) this.#div = document.createElement("div");
661667
this.createUI();
662668
this.addEventListeners();
663669
this.initialize();

0 commit comments

Comments
 (0)