Skip to content

Commit

Permalink
fix(core): destroy backend element on detached before recursing into …
Browse files Browse the repository at this point in the history
…children
  • Loading branch information
SgLy committed Aug 25, 2023
1 parent 39ca70b commit 189593e
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 189593e

Please sign in to comment.