LearnNewsExamplesConnect
Frontmatter
assigneesneo-gemini-julia
createdAtNov 10, 2026, 10:46 PM
updatedAtNov 11, 2026, 3:12 AM
githubUrlhttps://github.com/neomjs/neo/issues/20741
authorneo-gemini-julia
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtNov 11, 2026, 3:12 AM

VdomLifecycle#updateVdom leaves needsVdomUpdate false when yielding

Closed v14.0.0/archive-v14-0-0-chunk-1 buggood first issueaicore
neo-gemini-julia
neo-gemini-julia commented on Nov 10, 2026, 10:46 PM

Context

When a mounted component's updateVdom() yields to an in-flight ancestor (isParentUpdating) or an in-flight descendant (isChildUpdating) at src/mixin/VdomLifecycle.mjs:1399-1402, VDomUpdate.registerPostUpdate(...) queues the component for a deferred post-update cycle while leaving me.needsVdomUpdate === false. Because VdomLifecycle#mergeIntoParentUpdate (src/mixin/VdomLifecycle.mjs:994) requires parent.needsVdomUpdate === true to merge descendant updates into a pending ancestor cycle, sibling child updates triggered before the post-update runs fail to merge into the queued ancestor update and instead launch disjoint VDOM flights.

  • Live latest-open + closed sweep: checked latest 20 open (24 open total, green band; #20737..#20667) + closed searches (VdomLifecycle isChildUpdating mergeIntoParentUpdate needsVdomUpdate, registerPostUpdate needsVdomUpdate; read Out of Scope and Avoided Traps on #20124) at 2026-11-10T21:42:49Z; no equivalent or prior exclusion found
  • A2A in-flight claim sweep: checked latest 30 messages across all read states (status: 'all') at 2026-11-10T21:42:41Z; no overlapping [lane-claim] or [lane-intent]
  • MC sweep: "VdomLifecycle isChildUpdating isParentUpdating needsVdomUpdate mergeIntoParentUpdate sibling moveNode", 5 results + KB ticket sweep (#8825, #8829, #8834), no prior decision found (#8834 added me.needsVdomUpdate = true to the mergeIntoParentUpdate early return at :1372, leaving the isParentUpdating / isChildUpdating yield branch untouched)
  • Own-assignment sweep: 2 open in neomjs/neo (#20727, #20671), none overlapping

The Problem

Consider a mounted parent container root with three mounted child containers childA, childB, and childC, where childC (or a descendant inside childC) currently has an in-flight VDOM update (VDomUpdate.hasInFlightDescendants(root.id) === true, while root.isVdomUpdating === false and root.needsVdomUpdate === false):

  1. An existing mounted component item is moved atomically from childA into childB via childB.insert(index, item) (src/container/Base.mjs:701-718, 768-773):
    • childA.remove(item, false, true, true) silently removes {componentId: item.id} from childA.vdom.cn while childA.vnode still retains item's expanded vnode.
    • childB.updateDepth = -1 and childB.vdom.cn receives {componentId: item.id} (not yet present in childB.vnode).
    • root.updateDepth = -1 and root.promiseUpdate() are called (src/container/Base.mjs:769-771).
  2. Inside root.updateVdom() (src/mixin/VdomLifecycle.mjs:1399-1402):
    • !root.isParentUpdating(parentId, resolve) && !root.isChildUpdating(resolve) evaluates root.isChildUpdating(resolve) (src/mixin/VdomLifecycle.mjs:914-927), which registers root.id in VDomUpdate.postUpdateQueueMap behind childC's in-flight update and returns true.
    • root.updateVdom() returns immediately without setting root.needsVdomUpdate = true (root.needsVdomUpdate remains false).
  3. Immediately afterward in the same synchronous turn (while childC's flight is still in the air), childA and/or childB trigger update() (for example, updating a sibling attribute, header text, or child state):
    • childA.mergeIntoParentUpdate() and childB.mergeIntoParentUpdate() (src/mixin/VdomLifecycle.mjs:987-1005) walk up to root and check if (parent.needsVdomUpdate && parent.windowId === me.windowId && me.canMergeUpdate(parent.updateDepth, distance)) (:994).
    • Because root.needsVdomUpdate is false (even though root.updateDepth === -1 is already queued in postUpdateQueueMap), both mergeIntoParentUpdate checks return false!
  4. Instead of coalescing into root's pending -1 atomic move cycle, childA and childB launch independent disjoint VDOM flights while item has left childA.vdom and entered childB.vdom, splitting or racing the cross-container moveNode delta (insertNode in childB + removeNode removing the first document-order match in childB when childB precedes childA) before root's deferred post-update runs.

The same gap exists when updateVdom() defers to worker.on('themeFilesLoaded', ...) at src/mixin/VdomLifecycle.mjs:1415-1418: me has a pending update waiting on theme load, yet me.needsVdomUpdate remains false. Furthermore, once yielded ancestors correctly advertise needsVdomUpdate = true, two downstream VDOM hook assumptions surface:

  • When a yielded shallow ancestor (depth: 1, e.g. grid.Container during TreeStore filtering) absorbs deeper descendants (grid.Body, grid.View) via Teleportation as co-emitted disjoint roots in executeVdomUpdate, executeVdomUpdate previously invoked beforeExecuteVdomUpdate and afterExecuteVdomUpdate only on me, dropping lifecycle hooks on co-emitted roots.
  • Conversely, when a yielded structural ancestor (updateDepth: -1, e.g. grid.Container#ariaWrapper after a column-header sort yields to an in-flight header.Button) absorbs grid.View and its grid.Body instances into ariaWrapper's full-tree payload, View is omitted from emittedRoots; because Neo.grid.View scheduled scheduleRowMeasure() from afterExecuteVdomUpdate() (an emittedRoots-only hook) rather than afterVnodeSync(deltas), content-sized rows brought into view by the covering render skipped post-render measurement.

The Architectural Reality

Design authority: "The move flushes at the lowest common ancestor, where this container can still be a root of its own: its depth must reach the newcomer, which its vnode does not hold yet" (src/container/Base.mjs:715-716) and "Traverses the parent chain to merge this update into a same-window ancestor pending a VDOM update." (src/mixin/VdomLifecycle.mjs:972).

  • Neo.mixin.VdomLifecycle#updateVdom (src/mixin/VdomLifecycle.mjs:1364-1426) already sets me.needsVdomUpdate = true on three non-immediate branches:
    • if (me.isVdomUpdating) (:1364-1366)
    • if (me.mergeIntoParentUpdate(parentId)) (:1371-1373, added in #8834)
    • if (!me.vnodeInitialized || me.silentVdomUpdate) (:1376-1377)
  • When me is mounted with an initialized vnode (:1398-1424), yielding to me.isParentUpdating(parentId, resolve) or me.isChildUpdating(resolve) (:1399-1402) — or waiting on themeFilesLoaded (:1415-1418) — also parks a pending VDOM update for me without executing getVdomUpdatePayload() yet.
  • Setting me.needsVdomUpdate = true when updateVdom() yields at :1399-1402 (and when deferring to themeFilesLoaded at :1415-1418) preserves payload clearing invariants:
    • For isParentUpdating: an in-flight ancestor has already collected its payload and cleared afterSetNeedsVdomUpdate(false, true) (src/mixin/VdomLifecycle.mjs:395-418, :637-638) before setting isVdomUpdating = true, so its completion in resolveVdomUpdate (:1092-1147) will not clear me.needsVdomUpdate prematurely before triggerPostUpdates runs me.update().
    • For isChildUpdating: when the blocking descendant settles, VDomUpdate.triggerPostUpdates (src/manager/VDomUpdate.mjs:667-695) invokes me.update(), which either yields to any remaining in-flight descendant (retaining me.needsVdomUpdate = true) or executes me.executeVdomUpdate() at me.updateDepth, absorbing all merged children registered via VDomUpdate.registerMerged(me.id, ...) and clearing me._needsVdomUpdate = false in getVdomUpdatePayload() (:637-638).
  • In executeVdomUpdate (src/mixin/VdomLifecycle.mjs:408-489), iterating emittedRoots (Object.keys(updates)) via inFlightScopes.get(id) ensures every co-emitted disjoint root runs beforeExecuteVdomUpdate before dispatch and afterExecuteVdomUpdate after initiator/replaced-scope destruction checks and reply-completeness validation (skipping any root destroyed mid-flight), while absorbed non-root children remain excluded.
  • In Neo.grid.View (src/grid/View.mjs:354-366), moving scheduleRowMeasure() from afterExecuteVdomUpdate() to afterVnodeSync(deltas) (deltas !== null) aligns with Neo.form.field.Text#afterVnodeSync (src/form/field/Text.mjs:1030): syncVnodeTree walks expanded VNodes via ComponentManager.getChildren, so afterVnodeSync fires iff View itself or a covering ancestor rendered View's subtree into the DOM while skipping initial mount (deltas === null).

The Fix

  1. In src/mixin/VdomLifecycle.mjs (updateVdom, lines 1396-1435):
    • Set me.needsVdomUpdate = true when me.isParentUpdating(parentId, resolve) || me.isChildUpdating(resolve) returns true (in both the mounted+vnode branch and the !vnode breach-recovery branch) as well as on themeFilesLoaded deferral.
  2. In src/mixin/VdomLifecycle.mjs (executeVdomUpdate, lines 408-489):
    • Invoke beforeExecuteVdomUpdate across emittedRoots before dispatch and afterExecuteVdomUpdate across live (!root.isDestroyed) emittedRoots after destruction and reply-completeness checks, preserving absorbed-child exclusion.
  3. In src/grid/View.mjs (lines 354-366):
    • Replace afterExecuteVdomUpdate() with afterVnodeSync(deltas) so scheduleRowMeasure() runs after both view-owned updates and covering ancestor (updateDepth: -1) updates when deltas !== null, paired with a covering-ancestor unit spec in test/playwright/unit/grid/PremeasureRows.spec.mjs.
  4. Add test/playwright/unit/vdom/YieldedUpdateMerge.spec.mjs and browser E2E test/playwright/e2e/rendering/YieldedMoveCoalescingNL.spec.mjs (registered in ADAPTER_ELIGIBLE_SPECS and RUN_PATHS).

Contract Ledger Matrix

Target Surface Source of Authority Proposed Behavior Fallback Docs Evidence
Neo.mixin.VdomLifecycle#updateVdom (src/mixin/VdomLifecycle.mjs:1396-1435) src/container/Base.mjs:715-716, src/mixin/VdomLifecycle.mjs:972-996 Sets me.needsVdomUpdate = true whenever updateVdom() defers execution to isParentUpdating, isChildUpdating, or themeFilesLoaded, so descendant updates merge into me's queued update cycle via mergeIntoParentUpdate Cleared to false by getVdomUpdatePayload() (:637-638) when the deferred cycle executes Anchor & Echo JSDoc / inline comment in VdomLifecycle#updateVdom test/playwright/unit/vdom/YieldedUpdateMerge.spec.mjs + test/playwright/e2e/rendering/YieldedMoveCoalescingNL.spec.mjs
Neo.mixin.VdomLifecycle#executeVdomUpdate (src/mixin/VdomLifecycle.mjs:408-489) src/mixin/VdomLifecycle.mjs:405-490, test/playwright/unit/grid/PremeasureRows.spec.mjs:134 Runs beforeExecuteVdomUpdate across emittedRoots before dispatch and afterExecuteVdomUpdate across live (!root.isDestroyed) emittedRoots after initiator/replaced-scope destruction checks and reply-completeness validation Absorbed children omitted from emittedRoots, any root destroyed mid-flight, and batches throwing on omitted reply roots skip afterExecuteVdomUpdate Inline JSDoc in VdomLifecycle#executeVdomUpdate test/playwright/unit/vdom/YieldedUpdateMerge.spec.mjs + WrapTextMeasure.spec.mjs
Neo.grid.View#afterVnodeSync (src/grid/View.mjs:354-366) src/mixin/VdomLifecycle.mjs:156-163, 1249-1276, src/form/field/Text.mjs:1030 Schedules scheduleRowMeasure() whenever deltas !== null and this.rowGeometry is active, covering both view-owned renders and structural ancestor (updateDepth: -1) renders that absorb View Initial mount (deltas === null) skips redundant measurement; VdomLifecycle#afterExecuteVdomUpdate base no-op remains intact @summary + Anchor & Echo JSDoc on View#afterVnodeSync test/playwright/unit/grid/PremeasureRows.spec.mjs + test/playwright/e2e/grid/ContentSizedRowsExample.spec.mjs

Decision Record impact

none

Acceptance Criteria

  • When VdomLifecycle#updateVdom yields to isParentUpdating or isChildUpdating (or defers to themeFilesLoaded), me.needsVdomUpdate is true until the deferred update collects its payload.
  • While an ancestor container's -1 update (such as an atomic Container#insert cross-parent move) is queued in VDomUpdate.postUpdateQueueMap behind an unrelated in-flight descendant, subsequent update() calls on sibling child containers merge into the ancestor (VDomUpdate.registerMerged) rather than launching disjoint child VDOM flights.
  • All existing test/playwright/unit/vdom/ and full unit test suites pass with zero regressions, plus a new unit test covering cross-sibling Container#insert while a third sibling descendant is in-flight.

Out of Scope

  • Changing VDomUpdate depth calculation or canMergeUpdate rules.
  • Refactoring Container#afterSetNeedsVdomUpdate subtree clearing semantics when updateDepth is shallow.

Avoided Traps

  • Setting needsVdomUpdate = true unconditionally at the very top of updateVdom() before !mounted: When !mounted (src/mixin/VdomLifecycle.mjs:1380-1390), me.mountedPromise.then(...) re-triggers me.update(), and premature needsVdomUpdate = true on unmounted components could cause Abstract#set (if (!silent && me.needsVdomUpdate) return me.promiseUpdate()) to spin redundant updateVdom calls prior to mount. Scope the flag to branches where me is genuinely queued for a VDOM update (isParentUpdating, isChildUpdating, themeFilesLoaded).
  • Passing resolve twice into VDomUpdate.promiseCallbackMap: Note that updateVdom already parks (resolve, reject) at line 1361; verify the unit test checks that root.promiseUpdate() resolves after root's deferred post-update completes (not prematurely on the blocking child's completion).

Related

  • #8834 (needsVdomUpdate = true on mergeIntoParentUpdate)
  • #12957 (promise callback settlement on in-flight / merged updates)
  • #20124 (child-before-parent VDOM flight collision in grid.ScrollManager)

Ownership: self-assigned (@neo-gemini-julia).

Origin Session ID: 3b4d3f8f-c078-4cee-8876-b0db074a5c04 Retrieval Hint: "VdomLifecycle updateVdom isChildUpdating needsVdomUpdate false mergeIntoParentUpdate atomic move Container insert"

tobiu referenced in commit 5f407d6 - "fix(vdom): set needsVdomUpdate when VdomLifecycle#updateVdom yields (#20741) (#20743) on Nov 11, 2026, 3:12 AM
tobiu closed this issue on Nov 11, 2026, 3:12 AM