Skip to content

Commit

Permalink
fix: fix crash after node destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
Aarebecca committed Oct 22, 2024
1 parent 706a869 commit 64e5f91
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/g-lite/src/Canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,13 +671,11 @@ export class Canvas extends EventTarget implements ICanvas {
});

if (this.inited) {
if (!this.getConfig().cleanUpOnDestroy) {
if (parent.isMutationObserved) {
parent.dispatchEvent(unmountedEvent);
} else {
unmountedEvent.target = parent;
this.dispatchEvent(unmountedEvent, true);
}
if (parent.isMutationObserved) {
parent.dispatchEvent(unmountedEvent);
} else {
unmountedEvent.target = parent;
this.dispatchEvent(unmountedEvent, true);
}

// skip document.documentElement
Expand Down

0 comments on commit 64e5f91

Please sign in to comment.