LearnNewsExamplesServices
Frontmatter
id8870
titleInvestigate VNode.getById(null) error in Container.onScrollCapture
stateClosed
labels
bugaicore
assigneestobiu
createdAtJan 23, 2026, 9:00 PM
updatedAtJan 23, 2026, 10:35 PM
githubUrlhttps://github.com/neomjs/neo/issues/8870
authortobiu
commentsCount2
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 23, 2026, 10:35 PM

Investigate VNode.getById(null) error in Container.onScrollCapture

Closed v11.24.0 bugaicore
tobiu
tobiu commented on Jan 23, 2026, 9:00 PM

Description: During a feasibility analysis for Card Layout optimization, a runtime error was observed in the Portal App when switching tabs quickly or triggering layout updates:

VNode.mjs:132 Uncaught TypeError: Cannot read properties of null (reading 'id')
    at VNode.getById (VNode.mjs:132:27)
    at Container.onScrollCapture (Abstract.mjs:423:31)
    at Container.onScrollCapture (Base.mjs:1454:15)

Context: The error occurs in onScrollCapture, which attempts to look up a VDOM node by ID using VDomUtil.getById(me._vdom, data.target.id). The error message "Cannot read properties of null (reading 'id')" inside VNode.getById suggests that me._vdom (passed as the root) might be valid, but traversal encounters a null node, or me._vdom itself is unexpectedly null/invalid in a way that getById doesn't handle gracefully.

Hypothesis: This might be related to removeDom transitions where _vdom state on the component might be in flux or partially synced (e.g. _vnode vs _vdom mismatch, or _vdom containing null children due to template processing or other factors).

Goal: Investigate the root cause of this error and harden onScrollCapture or VDomUtil.getById against null/invalid inputs.

tobiu added the bug label on Jan 23, 2026, 9:00 PM
tobiu added the ai label on Jan 23, 2026, 9:00 PM
tobiu added the core label on Jan 23, 2026, 9:00 PM
tobiu
tobiu Jan 23, 2026, 9:03 PM

Input from Gemini 3 Pro:

Clarification: This error was observed during an experimental branch where _vnode state was being actively modified/nullified during updates. It may not be currently reproducible on the dev branch.

However, the fact that onScrollCapture can crash if the VDOM state is slightly out of sync with the Event target suggests a vulnerability. The fix should focus on graceful handling (e.g., checking if vdomNode exists before accessing properties) rather than assuming deep structural corruption in the stable codebase. This is a hardening task.

tobiu referenced in commit 4f62336 - "fix: Harden getById against null nodes (#8870)" on Jan 23, 2026, 10:35 PM
tobiu
tobiu Jan 23, 2026, 10:35 PM

Input from Gemini 3 Pro:

✦ I have applied the hardening fix to both src/util/VNode.mjs and src/util/VDom.mjs.

Both getById methods now gracefully handle null nodes during traversal, returning null instead of throwing a TypeError. This ensures stability in scenarios where VDOM/VNode state might be transiently inconsistent or contain null placeholders (e.g., during unmounts or race conditions).

Changes committed and pushed to feat/card-incremental-updates. Closing ticket.

tobiu assigned to @tobiu on Jan 23, 2026, 10:35 PM
tobiu closed this issue on Jan 23, 2026, 10:35 PM