LearnNewsExamplesServices
Frontmatter
id7076
titleImplement Asymmetric (Optimized) Vdom Update Depth
stateClosed
labels
enhancement
assigneestobiu
createdAtJul 16, 2025, 3:28 PM
updatedAtJul 18, 2025, 4:49 PM
githubUrlhttps://github.com/neomjs/neo/issues/7076
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJul 18, 2025, 4:49 PM

Implement Asymmetric (Optimized) Vdom Update Depth

Closed v10.0.0-beta.6 enhancement
tobiu
tobiu commented on Jul 16, 2025, 3:28 PM

Problem

The framework's VDOM update mechanism is not fully optimized. It suffers from two key issues:

  1. Depth-Blind Updates: The current ComponentManager.getVdomTree() method does not honor the updateDepth of child components, which can lead to incomplete VDOM payloads and broken renders.
  2. Missing Collision Detection: The VdomLifecycle.updateVdom() method does not check for update collisions with child components that are part of the current update's scope, creating a potential race condition.

Solution

This ticket proposes a comprehensive enhancement to the VDOM update lifecycle to create the most efficient and robust update payloads possible.

1. Asymmetric VDOM Serialization

The ComponentManager.getVdomTree() method will be refactored. Instead of working with a single, monolithic depth counter, it will recursively build the VDOM tree while honoring the specific updateDepth of each individual component it encounters. This will result in an optimally sized, asymmetric VDOM tree where each branch is only as deep as it needs to be.

2. Enhanced Collision Detection

A new isChildUpdating() method will be added to VdomLifecycle.mjs. This method will be called from updateVdom() and will be responsible for:

  • Recursively traversing all child components that fall within the scope of the upcoming update.
  • Checking the isVdomUpdating flag on each of these children.
  • If a collision is found, the parent's update will be postponed by setting needsVdomUpdate to true and preserving the resolve callback, preventing race conditions.

3. Code Clarity Improvements

As part of this refactoring, the method needsParentUpdate() in VdomLifecycle.mjs will be renamed to mergeIntoParentUpdate(). This more accurately describes its function of merging a component's update callback into a pending parent update.

This holistic approach will solve the existing correctness bugs while simultaneously implementing a highly optimized, asymmetric update strategy, making the framework's rendering core more efficient and robust.

tobiu assigned to @tobiu on Jul 16, 2025, 3:28 PM
tobiu added the enhancement label on Jul 16, 2025, 3:28 PM
tobiu referenced in commit c7582b2 - "Implement Asymmetric (Optimized) Vdom Update Depth #7076 storing the epic inside the repo while under development" on Jul 16, 2025, 8:22 PM
tobiu referenced in commit f8aecea - "#7076 manager.VDomUpdate WIP" on Jul 16, 2025, 8:33 PM
tobiu referenced in commit 6fabe86 - "#7076 WIP" on Jul 16, 2025, 9:44 PM
tobiu referenced in commit c52140f - "#7076 manager.VDomUpdate: getAdjustedUpdateDepth()" on Jul 17, 2025, 8:49 AM
tobiu referenced in commit d8a676c - "#7076 manager.VDomUpdate: getAdjustedUpdateDepth()" on Jul 17, 2025, 9:21 AM
tobiu referenced in commit dbff692 - "#7076 manager.VDomUpdate: getAdjustedUpdateDepth()" on Jul 17, 2025, 9:32 AM
tobiu referenced in commit 33eaaa3 - "#7076 functional.component.Base: updateDepth -1 when creating new child component instances" on Jul 17, 2025, 9:57 AM
tobiu referenced in commit f906ffe - "#7076 functional.component.Base: onEffectRunStateChange() => depth check fix" on Jul 17, 2025, 10:13 AM
tobiu referenced in commit 8712f40 - "#7076 WIP" on Jul 17, 2025, 11:18 AM
tobiu referenced in commit 1af5091 - "#7076 first unit tests" on Jul 17, 2025, 11:54 AM
tobiu referenced in commit a99a1e4 - "#7076 WIP" on Jul 17, 2025, 12:13 PM
tobiu referenced in commit 782e204 - "#7076 WIP" on Jul 17, 2025, 12:56 PM
tobiu referenced in commit ce48bd6 - "#7076 WIP" on Jul 17, 2025, 1:58 PM
tobiu referenced in commit e1ad229 - "#7076 more tests" on Jul 17, 2025, 2:22 PM
tobiu referenced in commit eca3543 - "#7076 WIP" on Jul 17, 2025, 4:38 PM
tobiu referenced in commit 471f3ca - "#7076 ticket update" on Jul 17, 2025, 4:46 PM
tobiu referenced in commit b29371b - "#7076 mixin.VdomLifecycle: converted executeVdomUpdate() to async" on Jul 17, 2025, 5:06 PM
tobiu referenced in commit 27724f3 - "#7076 WIP" on Jul 17, 2025, 5:29 PM
tobiu referenced in commit a3a56dd - "#7076 adjustment for the vnode ctor => opts.id ??= opts.componentId;" on Jul 17, 2025, 5:35 PM
tobiu referenced in commit f966881 - "#7076 WIP" on Jul 17, 2025, 5:51 PM
tobiu referenced in commit 6a87312 - "#7076 WIP" on Jul 17, 2025, 6:34 PM
tobiu referenced in commit 989dba0 - "#7076 WIP" on Jul 17, 2025, 6:41 PM
tobiu referenced in commit edeebfd - "#7076 WIP" on Jul 17, 2025, 10:20 PM
tobiu referenced in commit 6dbafdf - "#7076 WIP" on Jul 17, 2025, 11:59 PM
tobiu referenced in commit d70aa14 - "#7076 updateVdom() preventing all attempts before reaching isConstructed. container.Base: createItems() => preventing update() if not constructed." on Jul 18, 2025, 12:51 AM
tobiu referenced in commit bdbba03 - "#7076 manager.VDomUpdate WIP" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit f470126 - "#7076 WIP" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit 4a42389 - "#7076 manager.VDomUpdate: getAdjustedUpdateDepth()" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit fad0a5c - "#7076 manager.VDomUpdate: getAdjustedUpdateDepth()" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit de97019 - "#7076 manager.VDomUpdate: getAdjustedUpdateDepth()" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit 6b8bf1a - "#7076 functional.component.Base: updateDepth -1 when creating new child component instances" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit 8ade033 - "#7076 functional.component.Base: onEffectRunStateChange() => depth check fix" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit 9a435d6 - "#7076 WIP" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit e0eaa16 - "#7076 first unit tests" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit b3168c3 - "#7076 WIP" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit 154cfe8 - "#7076 WIP" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit 8b78c30 - "#7076 WIP" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit 8f53553 - "#7076 more tests" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit a4c7f81 - "#7076 WIP" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit a476d6c - "#7076 ticket update" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit ca21668 - "#7076 mixin.VdomLifecycle: converted executeVdomUpdate() to async" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit 0cde41d - "#7076 WIP" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit ad20df3 - "#7076 adjustment for the vnode ctor => opts.id ??= opts.componentId;" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit d3ca0aa - "#7076 WIP" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit 19cb6c5 - "#7076 WIP" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit 0604d72 - "#7076 WIP" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit 08f5fcb - "#7076 WIP" on Jul 18, 2025, 1:31 AM
tobiu referenced in commit cbe3731 - "#7076 WIP" on Jul 18, 2025, 1:31 AM