Skip to content

Commit

Permalink
Merge pull request #83 from SgLy/fix-early-destroy-backend-element
Browse files Browse the repository at this point in the history
fix(core): destroy backend element earilier
  • Loading branch information
LastLeaf authored Aug 29, 2023
2 parents 39ca70b + 189593e commit 20945c4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions glass-easel/src/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,9 @@ export class Element implements NodeCast {

private static checkAndCallDetached(node: Node) {
const callFunc = function callFunc(node: Node) {
if (node._$destroyOnDetach) {
node.destroyBackendElement()
}
if (node instanceof Element && node._$attached) {
node.childNodes.forEach(callFunc)
if (node instanceof Component) {
Expand All @@ -430,9 +433,6 @@ export class Element implements NodeCast {
node._$attached = false
}
}
if (node._$destroyOnDetach) {
node.destroyBackendElement()
}
}
callFunc(node)
}
Expand Down

0 comments on commit 20945c4

Please sign in to comment.