Skip to content

Commit

Permalink
Fix: avoiding synchronous unmount
Browse files Browse the repository at this point in the history
  • Loading branch information
stevematney committed Aug 15, 2023
1 parent eaec6c6 commit bc03fd0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ReactHTMLElement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ class ReactHTMLElement extends HTMLElement {
disconnectedCallback(): void {
if (!this._mountPoint) return;

this._root?.unmount();
// setTimeout to avoid synchronous unmount
setTimeout(() => this._root?.unmount(), 0);
}

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

0 comments on commit bc03fd0

Please sign in to comment.