Skip to content

Commit bc03fd0

Browse files
committed
Fix: avoiding synchronous unmount
1 parent eaec6c6 commit bc03fd0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ReactHTMLElement.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ class ReactHTMLElement extends HTMLElement {
8282
disconnectedCallback(): void {
8383
if (!this._mountPoint) return;
8484

85-
this._root?.unmount();
85+
// setTimeout to avoid synchronous unmount
86+
setTimeout(() => this._root?.unmount(), 0);
8687
}
8788

8889
constructor(template = '<div></div>', mountSelector = 'div') {

0 commit comments

Comments
 (0)