LearnNewsExamplesServices
Frontmatter
id19402
titlehide() is lost when a sibling update merges into the parent's cycle
stateClosed
labels
bugaicore
assigneesneo-opus-grace
createdAtOct 5, 2026, 12:46 PM
updatedAtOct 5, 2026, 1:36 PM
githubUrlhttps://github.com/neomjs/neo/issues/19402
authorneo-opus-grace
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtOct 5, 2026, 1:36 PM
milestonev13.2

hide() is lost when a sibling update merges into the parent's cycle

neo-opus-grace
neo-opus-grace commented on Oct 5, 2026, 12:46 PM

Context

Vega's defect-note (2026-10-05 10:12Z): in the Institution's Seat group, a Change button hidden while its sibling Adopt button is hidden and renamed in the same synchronous pass stays in the DOM. Real Chrome read it at display: flex six times over 1.8 s while the component read hidden: true. The Institution worked around it by not renaming a button that is being hidden.

Reproduced in the Engine at dev 036cb05a40, so this is an independent second occurrence:

  • Component tier (real Chrome, real workers): a replica of the Seat group switch leaves both Change buttons in the DOM. The workaround variant removes them.
  • Unit tier, deterministic and minimal: a mounted hbox [label, A, B], warmed by one ordinary update, then in one pass A.hidden = true; B.set({hidden: true, text: 'Adopt '}). The flight emits removeNode B only, and the parent's vnode keeps A while A.vdom.removeDom === true.

Live latest-open sweep: the latest 20 open neo issues at 2026-10-05T10:46Z, plus a search for denseUpdate and for the symptom; no equivalent. A2A: Vega's note and my own lane-intent (10:28Z). Memory Core: the sparse-tree design of 2026-01-20 (below) and denseUpdate's later addition. Own assignments: none on this surface.

The Problem

A component the engine reports hidden stays visible: the state and the DOM disagree with no error. It needs only an ordinary pattern, where two siblings change in one handler and one of them both hides and changes another config.

The Architectural Reality

  • Component#hide() (src/component/Base.mjs:1653, the removeFn at :1657–1661) dirties the child's vdom directly: me.vdom.removeDom = true, then me.parent.updateDepth = 2; me.parent.update(). It relies on the parent's depth-2 payload to carry the removal, and it registers nothing in VDomUpdate.
  • VdomLifecycle#executeVdomUpdate (src/mixin/VdomLifecycle.mjs, the payload line at :300) builds a sparse payload for an owner whose depth is not 1: ids = component.updateDepth !== 1 && !component.denseUpdate ? mergedChildIds : null. TreeBuilder (src/util/vdom/TreeBuilder.mjs:67–70) then prunes every child outside mergedChildIds to a {componentId} reference, on the reading that unmerged children are clean.
  • The sequence:
    1. A's hide starts the parent's flight at depth 2.
    2. B's hide calls parent.update() while that flight is in the air, which sets needsVdomUpdate.
    3. B's own text update (inside set()) merges into the parent through mergeIntoParentUpdate, so mergedChildIds = [B].
    4. The flight collects after its 1 ms yield, now sparse: B expanded, A a reference, and A's removal is never diffed. The payload, traced: cn: [{label, ref}, {A, ref}, {B, removeDom, cn: […]}].
  • The intended exception already exists. denseUpdate is documented as "the owner changed descendants silently within its updateDepth, so the cycle ships that subtree whole instead of sparse, even when children merge into it". grid.View (src/grid/View.mjs:424–425) sets it next to its depth bump for exactly this reason. hide() changes a descendant silently in the same way and does not set it.
  • show() bumps the parent to depth −1, which TreeBuilder always builds dense (depth !== -1 guards the pruning), so it is not affected.

The Fix

In hide()'s removeFn, set me.parent.denseUpdate = true beside me.parent.updateDepth = 2, with the one-line reason. executeVdomUpdate resets the flag at collection, so it lasts exactly one cycle.

Acceptance Criteria

  • A unit arm (the minimal sequence above) asserts that the flight removes both A and B, and the parent's vnode keeps only the label. Red on dev first.
  • A component arm in real Chrome runs the same pass and asserts that neither button is left in the DOM. Red on dev first.
  • npm run test-unit and npm run test-components stay green.

Out of Scope

  • Other owners that raise their own updateDepth before changing children (form/Fieldset.mjs:222, calendar/view/calendars/List.mjs:76, tab/Container.mjs:260). Whether any of them changes a child silently is unverified here, so no claim is made.
  • The Institution's workaround. It stays harmless after the fix and is Vega's to remove.

Related

  • Institution #559 / #564, where the defect was seen.
  • The sparse-tree and denseUpdate design that this ticket aligns with: grid.View's precedent.

Origin Session ID: 90464c20-910b-4abd-ac1d-d86f8fbccb13 Retrieval Hint: query_raw_memories("denseUpdate sparse payload hide removeDom merged child")

tobiu referenced in commit 58fbeaf - "fix(component): hide() keeps its removal when a sibling update merges into the parent cycle (#19402) (#19403) on Oct 5, 2026, 1:36 PM
tobiu closed this issue on Oct 5, 2026, 1:36 PM