LearnNewsExamplesServices
Frontmatter
id8900
titleImplement JIT ID Generation in TreeBuilder
stateClosed
labels
enhancementaicore
assigneestobiu
createdAtJan 28, 2026, 4:29 PM
updatedAtJan 28, 2026, 5:41 PM
githubUrlhttps://github.com/neomjs/neo/issues/8900
authortobiu
commentsCount1
parentIssue8899
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 28, 2026, 5:41 PM

Implement JIT ID Generation in TreeBuilder

Closed v11.24.0 enhancementaicore
tobiu
tobiu commented on Jan 28, 2026, 4:29 PM

Objective: Implement the "App Authority" logic for VDOM IDs by modifying TreeBuilder to generate IDs just-in-time (JIT) during payload construction.

Tasks:

  1. Modify src/util/vdom/TreeBuilder.mjs:

    • Update #buildTree method.
    • When processing a node in VDOM mode (where childKey is effectively for VDOM construction), check if node.id is missing.
    • If missing, generate a new ID using Neo.getId('neo-vnode').
    • Crucial: Assign this ID in-place to the node object (mutation) to ensure the ID persists on the VDOM blueprint for future updates.
    • Ensure this logic runs before any child recursion.
  2. Modify src/vdom/VNode.mjs:

    • Remove the current ID auto-generation logic (Neo.getId(...)).
    • Change the constructor to throw an error if config.id is missing.
    • This enforces the contract that all nodes arriving at the VDOM Worker must already have IDs.

Constraint:

  • Respect the existing ID prefix conventions (vnode vs vtext).
  • Ensure removeDom: true nodes also get IDs (to preserve identity if they are re-shown).
tobiu added the enhancement label on Jan 28, 2026, 4:29 PM
tobiu added the ai label on Jan 28, 2026, 4:29 PM
tobiu added the core label on Jan 28, 2026, 4:29 PM
tobiu cross-referenced by #8901 on Jan 28, 2026, 4:29 PM
tobiu added parent issue #8899 on Jan 28, 2026, 4:34 PM
tobiu referenced in commit a1a369b - "feat: Implement JIT ID Generation in TreeBuilder (Ticket #8900)" on Jan 28, 2026, 4:48 PM
tobiu
tobiu Jan 28, 2026, 4:49 PM

Input from Gemini 3 Pro:

✦ I have implemented the JIT ID generation logic.

Changes:

  1. Modified src/util/vdom/TreeBuilder.mjs:
    • Added JIT ID generation in #buildTree when running in VDOM mode (childKey === 'cn').
    • Uses Neo.getId('vtext') for text nodes and Neo.getId('vnode') for others.
    • Assigns IDs in-place to the source VDOM node to ensure persistence.
  2. Modified src/vdom/VNode.mjs:
    • Removed auto-generation fallback.
    • Now throws an error if config.id is missing, enforcing the App-Worker authority.

Next Steps: I will proceed with Ticket #8901 (Cleanup) in this same branch.

tobiu assigned to @tobiu on Jan 28, 2026, 5:41 PM
tobiu closed this issue on Jan 28, 2026, 5:41 PM