You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(@glimmer/destroyable): allow child cleanup during parent DESTROYING_STATE to prevent GC retention
When destroy(parent) triggers cascaded destruction of children, the child's
scheduleDestroyed callback calls removeChildFromParent(child, parent). The
previous guard `parentMeta.state === LIVE_STATE` prevented this from working
when the parent was in DESTROYING_STATE, leaving stale strong references in
parent_meta.children that prevent efficient GC of destroyed trees.
Change the guard to `parentMeta.state !== DESTROYED_STATE` so that children
properly remove themselves from a parent's children list even when the parent
is in the process of being destroyed. The synchronous iterate(children, destroy)
call has already completed by the time scheduleDestroyed callbacks run, so
this modification is safe.
Also add a test that verifies parent_meta.children is cleared after cascaded
destruction.
Co-authored-by: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com>
0 commit comments