LearnNewsExamplesServices
Frontmatter
id18908
titleThe vdom parent walks restart from the component itself at an ancestor with no parentId, and overflow the stack
stateClosed
labels
bugaicore
assigneesneo-opus-ada
createdAtSep 18, 2026, 5:29 PM
updatedAtSep 18, 2026, 6:49 PM
githubUrlhttps://github.com/neomjs/neo/issues/18908
authorneo-opus-ada
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtSep 18, 2026, 6:49 PM

The vdom parent walks restart from the component itself at an ancestor with no parentId, and overflow the stack

neo-opus-ada
neo-opus-ada commented on Sep 18, 2026, 5:29 PM

Context

Found by @neo-opus-grace while reviewing #18901: createNeoInstance with parentId: undefined ended in RangeError inside GridBody.mergeIntoParentUpdate. Reproduced in the unit tier on dev@6d61d8a900. A Component created with parentId: undefined keeps undefined (the config default 'document.body' does not replace an explicit undefined), and for its child both walks throw:

mergeIntoParentUpdate() โ†’ RangeError: Maximum call stack size exceeded
isParentUpdating()      โ†’ RangeError: Maximum call stack size exceeded

The Problem

VdomLifecycle#isParentUpdating(parentId=this.parentId, resolve, distance=1) and #mergeIntoParentUpdate(parentId=this.parentId, distance=1) walk up by recursing with parent.parentId. The default parameter is meant for the first call only. But a recursion that passes an ancestor's undefined takes the default again, restarts from the component's own parentId, and walks the same chain forever. Every update of a component below such an ancestor then throws, since update() calls mergeIntoParentUpdate() first.

The Architectural Reality

  • src/mixin/VdomLifecycle.mjs: the two walks (:749, :794), and their callers in updateVdom's path (mergeIntoParentUpdate(parentId), then isParentUpdating(parentId, resolve)).
  • A walk ends at 'document.body' or at an id that resolves to no component. An undefined id is neither, because the default parameter turns it back into this.parentId.
  • No other src method recurses with a this-derived default parameter.

The Fix

Both walks pass the next id as parent.parentId ?? null. A null argument takes no default, resolves to no component, and ends the walk as a missing ancestor does today.

Acceptance Criteria

  • With an ancestor whose parentId is undefined, both walks return false instead of throwing, witnessed by a unit arm that is red without the fix.
  • The walks' behaviour for a normal chain is unchanged: the existing merge and collision specs stay green.

Out of Scope

  • Whether a Component may be created with parentId: undefined at all.

Related

#18899 ยท #18901 (the review that found it)

Decision Record impact: none.

Live latest-open sweep: the latest 20 open issues at 2026-09-18T15:28Z, and an all-state search for isParentUpdating, mergeIntoParentUpdate and Maximum call stack: no equivalent. A2A: @neo-opus-grace suggested the ticket and did not claim it.

Origin Session ID: 6ed6621f-e2e4-4b9d-9a95-744679cb3c59 Retrieval Hint: "VdomLifecycle isParentUpdating mergeIntoParentUpdate default parameter this.parentId undefined ancestor infinite recursion RangeError"