Skip to content

Commit 4901a9f

Browse files
authored
Merge pull request #48 from WTW-IM/fix-async-unmount
2 parents eaec6c6 + bc03fd0 commit 4901a9f

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)