Repository navigation
fix(components): stop repeated node ids from looping the tree ancestry - #447
Conversation
A component report with repeated node ids could make the panel's parent map loop, so ownerOf and reveal walked it forever and froze the panel. The report guard now drops a node whose id the tree already used, along with its subtree. The panel keeps only the first row with an id in its index, and both ancestry walks stop at a repeated id. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
View your CI Pipeline Execution ↗ for commit ca9ae91
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗ ☁️ Nx Cloud last updated this comment at |
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
|
What and why
A component report with repeated node ids could make the panel's ID-indexed parent map loop.
ownerOfandrevealfollowed that map with no cycle check, so selecting a directive host could freeze the panel's UI thread (CWE-835, denial of service from a reporting connection).guardComponentRoots(packages/devtools/src/rpc/component-report-guard.ts) drops any node whose id the tree already used, together with its subtree, before the page is published.parentscannot form a cycle.ownerOfandrevealnow walk through a newancestors()helper that also stops at a repeated id.How it was verified
pnpm commit:check(commit messages follow the guidelines)pnpm format:checkpnpm typecheck(includes thengctemplate checks)pnpm test,pnpm test:devtoolsandpnpm test:panel(test:devtools: 3647 passed;test:panel: 850 passed;pnpm testnot run)pnpm skills:check(when.claude/changed) N/Aapps/docsupdated andpnpm docs:buildpasses, or theno-docslabel added with the reason below (no behavior change for valid reports; ids from the collector are already unique)pnpm extension:buildandextension/uicommitted (whenapp/changed)New tests: duplicate-id case in
rpc-boundary.test.ts, andapp/src/__tests__/component-tree-ancestors.test.tsfor the loop cases.Screenshots
N/A
Notes for reviewers
The guard drops the duplicate node and its subtree rather than rejecting the whole report, matching how it already handles other bad nodes, so one bad entry does not blank the page.
Summary by CodeRabbit