Skip to content

Commit f2456c4

Browse files
authored
Show numeric fiber ID when @c label is unresolved in find results.
Components deep in the tree (e.g., 3000+ components in a React Native app) don't get @c labels assigned because getTree() traversal stops early. find returns @c? which can't be used with get-component. Fix: output @c?(id:667) so users can pass the numeric ID directly.
1 parent 126251c commit f2456c4

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/agent-react-devtools/src/formatters.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,11 @@ export function formatSearchResults(results: TreeNode[]): string {
155155
if (results.length === 0) return 'No components found';
156156

157157
return results
158-
.map((n) => formatRef({ label: n.label, type: n.type, name: n.displayName, key: n.key, errors: n.errors, warnings: n.warnings }))
158+
.map((n) => {
159+
// Use numeric id as label when @c label isn't resolved (e.g., tree not traversed)
160+
const effectiveLabel = n.label === '@c?' ? `@c?(id:${n.id})` : n.label;
161+
return formatRef({ label: effectiveLabel, type: n.type, name: n.displayName, key: n.key, errors: n.errors, warnings: n.warnings });
162+
})
159163
.join('\n');
160164
}
161165

0 commit comments

Comments
 (0)