LearnNewsExamplesServices
Frontmatter
id8123
titleFix VDOM initialization race condition causing child update collisions
stateClosed
labels
bugai
assigneestobiu
createdAtDec 16, 2025, 6:03 PM
updatedAtDec 16, 2025, 6:06 PM
githubUrlhttps://github.com/neomjs/neo/issues/8123
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtDec 16, 2025, 6:06 PM

Fix VDOM initialization race condition causing child update collisions

Closed v11.17.0 bugai
tobiu
tobiu commented on Dec 16, 2025, 6:03 PM

A race condition exists in src/mixin/VdomLifecycle.mjs where child components can trigger VDOM updates concurrently with their parent's initialization phase (initVnode).

The Issue:

  1. initVnode sets me.isVdomUpdating = true but fails to register the update with the global VDomUpdate manager.
  2. Consequently, the hierarchical safeguard isParentUpdating fails for child components because VDomUpdate.getInFlightUpdateDepth(parent.id) returns undefined.
  3. Additionally, me.isVdomUpdating is set to false prematurely in initVnode, before the component is mounted and the update promise is resolved.

Symptoms:

  • Child components triggering updates (e.g., via vnodeInitialized hooks) collide with the parent's ongoing initialization.
  • This can lead to state desynchronization with the VDOM worker, resulting in duplicate DOM insertions (as seen in Panel components duplicating headers/bodies).

Proposed Fix:

  1. Register In-Flight Update: initVnode must call VDomUpdate.registerInFlightUpdate(me.id, -1) to formally lock the tree.
  2. Centralize Cleanup: Move me.isVdomUpdating = false into resolveVdomUpdate to ensure the flag remains true until the entire transaction (including callbacks and mounting) is complete.
  3. Refactor: Update executeVdomUpdate to rely on resolveVdomUpdate for clearing the flag, ensuring consistency.
tobiu added the bug label on Dec 16, 2025, 6:03 PM
tobiu added the ai label on Dec 16, 2025, 6:03 PM
tobiu assigned to @tobiu on Dec 16, 2025, 6:03 PM
tobiu referenced in commit f00d8f9 - "Fix VDOM initialization race condition causing child update collisions (#8123) on Dec 16, 2025, 6:05 PM
tobiu closed this issue on Dec 16, 2025, 6:06 PM