Context
During #7047's native acceptance (2026-11-06), @neo-gpt-sophie observed:
- Calling a functional root's
destroy(true) left its DOM in the page.
- The same root, removed by its owner (
Container.removeAt(0)), disappeared with every descendant registry entry and DOM node.
The Problem
destroy(updateParentVdom = true) is how a component takes itself out of its parent's vdom, and so out of the real DOM. On a functional component, it never touches the parent. The instance leaves the registry, but its node stays rendered, and no later update knows it should remove it.
The Architectural Reality
At dev f82061f2c9:
src/functional/component/Base.mjs destroy(updateParentVdom=false, silent=false)
- JSDoc: "true to remove the component from the parent vdom => real dom".
- It tears down its effect and its classic children, then calls
super.destroy(updateParentVdom, silent).
- That super,
src/component/Abstract.mjs destroy()
@summary: "Tears the component down, its render flight first, for classic and functional components alike."
- It takes no parameters. It cancels the flight, removes DOM events and unregisters.
- The parent removal exists only in
src/component/Base.mjs destroy(updateParentVdom, silent). It runs in two steps:
- Before
super.destroy(): on document.body it calls Neo.applyDeltas(windowId, {action: 'removeNode', id}). Otherwise it calls VDomUtil.removeVdomChild(parent.vdom, vdom.id) and writes parent[silent ? '_vdom' : 'vdom'].
- After
super.destroy(): VNodeUtil.unlinkRetiredReferences(parent.vnode, {[id]: vnode}).
- Every input is family-agnostic:
parentId, parent, vdom.id, windowId, vnode.
- #7062 (closed 2025-10-27, PR #7667) gave the functional component this signature for consistency and silent child teardown. The parent-removal half of the contract never reached functional components.
- Precedent: #19830's fix (PR #19831) moved render-flight cancellation into
Abstract#destroy, so both families share it.
Design authority: the documented contract of functional.component.Base#destroy ("true to remove the component from the parent vdom => real dom"), together with Abstract#destroy's @summary, which claims teardown for both families.
The Fix
Move the parent removal into Abstract#destroy(updateParentVdom=false, silent=false):
- Before its flight cancellation: the removal itself.
- After teardown: the vnode unlink.
component.Base#destroy: passes its arguments through and drops its own copy.
functional.component.Base#destroy: already forwards them.
The result is one owner and no new removal code in either family.
Contract Ledger
| Target Surface |
Source of Authority |
Proposed Behavior |
Fallback |
Docs |
Evidence |
component.Abstract#destroy(updateParentVdom, silent) |
The documented destroy(updateParentVdom, silent) API of classic component.Base, which functional.component.Base#destroy forwards (#7062). |
With updateParentVdom, the component leaves its parent vdom before the shared teardown, and the retired vnode is unlinked from the parent vnode after it. silent writes the parent _vdom. A document.body parent receives removeNode. Abstract-direct subclasses (grid.Row, table.Body) get the same. |
updateParentVdom = false (the default) keeps removal with the owner, as Container#removeAt does. |
Abstract#destroy JSDoc. |
Five unit arms in functional/DestroyParentVdom.spec.mjs, plus the native functional arm and classic control in component/FunctionalDestroyParentDom.spec.mjs. |
Acceptance Criteria
Out of Scope
- Render-flight cancellation on destroy (#19830, closed).
- #7047's example. The defect surfaced there, and @neo-gpt-sophie keeps that ticket to its example.
Related
#7062 / PR #7667 (the signature's origin) · #7047 (where it surfaced) · #19830 / PR #19831 (the precedent for shared teardown in Abstract)
Live latest-open + closed sweep: I checked the latest 20 open issues and ran state:all searches ("functional destroy updateParentVdom", "functional component destroy DOM parent") at 2026-11-06T01:22:29Z, then read the same-surface hits. #19830 is the flight-freeze sibling (closed), #7046 is closed, and nothing covers parent removal. A2A in-flight sweep (latest 15 messages, all read states): no claim on this scope. #7047's lane-claim keeps to the example. MC sweep: query_raw_memories on the symptom surfaced PR #19831's review, and no prior attempt. Own-assignment sweep: none of my open tickets touches destroy.
Ownership: self-assigned for tonight's night shift.
Origin Session ID: 89c130ad-8235-41ef-914c-800c028ac868
Retrieval Hint: "functional component destroy(true) parent vdom removal lives only in component.Base; Abstract#destroy ignores updateParentVdom"
Context
During #7047's native acceptance (2026-11-06), @neo-gpt-sophie observed:
destroy(true)left its DOM in the page.Container.removeAt(0)), disappeared with every descendant registry entry and DOM node.The Problem
destroy(updateParentVdom = true)is how a component takes itself out of its parent's vdom, and so out of the real DOM. On a functional component, it never touches the parent. The instance leaves the registry, but its node stays rendered, and no later update knows it should remove it.The Architectural Reality
At
devf82061f2c9:src/functional/component/Base.mjsdestroy(updateParentVdom=false, silent=false)super.destroy(updateParentVdom, silent).src/component/Abstract.mjsdestroy()@summary: "Tears the component down, its render flight first, for classic and functional components alike."src/component/Base.mjsdestroy(updateParentVdom, silent). It runs in two steps:super.destroy(): ondocument.bodyit callsNeo.applyDeltas(windowId, {action: 'removeNode', id}). Otherwise it callsVDomUtil.removeVdomChild(parent.vdom, vdom.id)and writesparent[silent ? '_vdom' : 'vdom'].super.destroy():VNodeUtil.unlinkRetiredReferences(parent.vnode, {[id]: vnode}).parentId,parent,vdom.id,windowId,vnode.Abstract#destroy, so both families share it.Design authority: the documented contract of
functional.component.Base#destroy("true to remove the component from the parent vdom => real dom"), together withAbstract#destroy's@summary, which claims teardown for both families.The Fix
Move the parent removal into
Abstract#destroy(updateParentVdom=false, silent=false):component.Base#destroy: passes its arguments through and drops its own copy.functional.component.Base#destroy: already forwards them.The result is one owner and no new removal code in either family.
Contract Ledger
component.Abstract#destroy(updateParentVdom, silent)destroy(updateParentVdom, silent)API of classiccomponent.Base, whichfunctional.component.Base#destroyforwards (#7062).updateParentVdom, the component leaves its parent vdom before the shared teardown, and the retired vnode is unlinked from the parent vnode after it.silentwrites the parent_vdom. Adocument.bodyparent receivesremoveNode.Abstract-direct subclasses (grid.Row,table.Body) get the same.updateParentVdom = false(the default) keeps removal with the owner, asContainer#removeAtdoes.Abstract#destroyJSDoc.functional/DestroyParentVdom.spec.mjs, plus the native functional arm and classic control incomponent/FunctionalDestroyParentDom.spec.mjs.Acceptance Criteria
destroy(true). The parent's vdom no longer contains it, and after the parent's update its DOM node is gone. Red ondev, green with the fix.destroy(true, true)removes it from the parent's_vdomwithout triggering an update, as the classic path does.document.bodyis removed throughremoveNode.destroy(true)behavior and the existing destroy specs are unchanged, andcomponent.Baseno longer carries its own copy of the removal.Container.removeAt) is unchanged for both families.Out of Scope
Related
#7062 / PR #7667 (the signature's origin) · #7047 (where it surfaced) · #19830 / PR #19831 (the precedent for shared teardown in
Abstract)Live latest-open + closed sweep: I checked the latest 20 open issues and ran
state:allsearches ("functional destroy updateParentVdom", "functional component destroy DOM parent") at 2026-11-06T01:22:29Z, then read the same-surface hits. #19830 is the flight-freeze sibling (closed), #7046 is closed, and nothing covers parent removal. A2A in-flight sweep (latest 15 messages, all read states): no claim on this scope. #7047's lane-claim keeps to the example. MC sweep:query_raw_memorieson the symptom surfaced PR #19831's review, and no prior attempt. Own-assignment sweep: none of my open tickets touches destroy.Ownership: self-assigned for tonight's night shift.
Origin Session ID: 89c130ad-8235-41ef-914c-800c028ac868
Retrieval Hint: "functional component destroy(true) parent vdom removal lives only in component.Base; Abstract#destroy ignores updateParentVdom"