LearnNewsExamplesServices
Frontmatter
id8596
titleEnhance VDOM ID Stability to Remove Manual ID Requirement in TreeList
stateClosed
labels
bugaicore
assigneestobiu
createdAtJan 13, 2026, 2:11 PM
updatedAtJan 13, 2026, 2:38 PM
githubUrlhttps://github.com/neomjs/neo/issues/8596
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 13, 2026, 2:38 PM

Enhance VDOM ID Stability to Remove Manual ID Requirement in TreeList

Closed v11.21.0 bugaicore
tobiu
tobiu commented on Jan 13, 2026, 2:11 PM

Context: The recent fix for the TreeList "Chimera Bug" (#8595) involved manually assigning deterministic IDs to UL containers to prevent Neo.util.VDom.syncVdomState from erroneously assigning them IDs from sibling LI nodes during race conditions.

Problem: While effective, this manual ID assignment feels like a workaround ("monkey patching"). The framework's core VDOM engine, specifically Neo.util.VDom.syncVdomState and Neo.vdom.Helper, should theoretically be robust enough to handle dynamic nodes without requiring manual IDs for every structural element. The goal of ensureStableIds and similar initiatives was to make this automatic.

Objective:

  1. Investigate why syncVdomState fails to distinguish between the UL container and the LI item when the UL appears dynamically.
  2. Create a focused reproduction case (unit test) that isolates syncVdomState behavior with dynamic sibling nodes where one lacks an ID.
  3. Implement a fix in src/util/VDom.mjs or src/vdom/Helper.mjs that makes the manual UL ID assignment in TreeList unnecessary.
  4. Verify the fix by removing the manual ID from TreeList and running the race condition tests.

Goal: Ensure Neo.tree.List (and other components) works robustly with purely dynamic IDs for container elements.

tobiu added the bug label on Jan 13, 2026, 2:11 PM
tobiu added the ai label on Jan 13, 2026, 2:11 PM
tobiu added the core label on Jan 13, 2026, 2:11 PM
tobiu assigned to @tobiu on Jan 13, 2026, 2:11 PM
tobiu referenced in commit ff6dd1f - "fix(vdom): Prevent Chimera VDOM corruption in syncVdomState (#8596) on Jan 13, 2026, 2:35 PM
tobiu
tobiu Jan 13, 2026, 2:36 PM

Input from Gemini 3 Pro:

✦ I have implemented a core VDOM fix for the Chimera Bug and reverted the manual workaround in TreeList.

Changes:

  1. Core VDOM Fix (src/util/VDom.mjs): Modified syncVdomState to abort ID synchronization if the node tags (vnode.nodeName vs vdom.tag) do not match. This prevents the "Chimera" scenario where a UL container (appearing dynamically) inherits the ID of a sibling LI item during a race condition.
  2. TreeList Revert (src/tree/List.mjs): Removed the manual ID assignment (parentId + '__ul') introduced in the previous fix. The core VDOM engine now handles this safely.
  3. New Unit Test (test/playwright/unit/vdom/SyncVdomState.spec.mjs): Added a dedicated test suite for syncVdomState that explicitly reproduces the mismatched-tag scenario and asserts that IDs are NOT synced.
  4. Test Fix (test/playwright/unit/draggable/container/SortZone.spec.mjs): Fixed a flaky test failure by explicitly importing VdomHelper, which was previously relying on implicit global state from other tests.

Verification:

  • npx playwright test test/playwright/unit/vdom/SyncVdomState.spec.mjs ✅ Passed
  • npx playwright test test/playwright/unit/tree/ListRaceCondition.spec.mjs ✅ Passed (without manual IDs)
  • All unit tests passed locally.

The changes have been pushed to dev.

tobiu cross-referenced by #8592 on Jan 13, 2026, 2:37 PM
tobiu closed this issue on Jan 13, 2026, 2:38 PM