Skip to content

fix(scenegraph): keep m.global's own descendants out of its findNode search - #1096

Merged
lvcabral merged 1 commit into
masterfrom
fix/global-findnode-own-subtree
Jul 28, 2026
Merged

fix(scenegraph): keep m.global's own descendants out of its findNode search#1096
lvcabral merged 1 commit into
masterfrom
fix/global-findnode-own-subtree

Conversation

@lvcabral

Copy link
Copy Markdown
Owner

Stacked on the global-node-parent PR (which is itself stacked on #1094). Merge in order.

Root cause

Device-confirmed: a node appended to m.global is found by neither m.global.findNode() nor m.top.findNode().

findNode's search space is the subject node's nearest component ancestor. For the global node that is the Scene, and the global node itself sits outside the Scene's children — so its own subtree is not in that space. This engine searched the subject's own subtree first and found it.

Fix

Skip that self-search for the global node. Every other node's subtree is part of its component ancestor's subtree anyway, so searching it first is only a shortcut; their behavior is unchanged.

probe device before after
m.global.findNode("GlobalOwnChild") invalid Node#GlobalOwnChild invalid
m.top.findNode("GlobalOwnChild") invalid invalid invalid

Note this is a narrowing — an app that appended to m.global and relied on finding it would have been broken on a device already.

Tests

GlobalFindNode.test.js — a node appended to m.global is reachable from neither search.

Full suite green (2222), lint and prettier clean.

🤖 Generated with Claude Code

…search

Device-confirmed: a node appended to m.global is found by neither
m.global.findNode() nor m.top.findNode(). findNode's search space is the
subject node's nearest component ancestor; for the global node that is the
Scene, and the global node itself sits outside the Scene's children, so its
own subtree is not in that space. This engine searched the subject's own
subtree first and found it.

Skip that self-search for the global node. Every other node's subtree is
part of its component ancestor's subtree anyway, so searching it first is
only a shortcut and their behavior is unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@lvcabral
lvcabral force-pushed the fix/global-findnode-own-subtree branch from 0f45874 to 3243948 Compare July 28, 2026 22:56
@lvcabral
lvcabral changed the base branch from fix/global-node-parent to master July 28, 2026 22:56
@lvcabral
lvcabral merged commit 0b3e9e4 into master Jul 28, 2026
1 check failed
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant