You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 824e084
Browse filesBrowse the repository at this point in the historyBrowse files
The import installs the React DevTools global hook, so it has to run before React initializes. If it runs too late, React won't connect to it, and the tools will report an empty tree.
64
-
65
-
If the [React Developer Tools](/learn/react-developer-tools) browser extension is already installed, `react-devtools-cdt-mcp` reuses the extension's hook instead of installing a second one, so both keep working.
63
+
`react-devtools-cdt-mcp` has to load before React does. If you import it after React, the tools won't see your components.
66
64
67
65
<Pitfall>
68
66
@@ -668,22 +666,22 @@ register();
668
666
669
667
## Troubleshooting {/*troubleshooting*/}
670
668
671
-
### My agent doesn't see any React tools {/*my-agent-doesnt-see-any-react-tools*/}
669
+
####My agent doesn't see any React tools {/*my-agent-doesnt-see-any-react-tools*/}
672
670
673
671
Check that [third-party developer tools](https://developer.chrome.com/blog/devtools-for-agents-3p-tools) are enabled in your Chrome DevTools MCP setup. Then check that the page selected in Chrome DevTools MCP imports `react-devtools-cdt-mcp/register`. The tools are discovered per page, when the page loads or is selected.
674
672
675
-
### The component tree is empty {/*the-component-tree-is-empty*/}
673
+
####The component tree is empty {/*the-component-tree-is-empty*/}
676
674
677
675
`react-devtools-cdt-mcp/register` was imported after React initialized. Move the import to the very first line of your entry file, before any import that loads `react-dom`.
678
676
679
-
### I'm getting an error about a browser-like environment {/*im-getting-an-error-about-a-browser-like-environment*/}
677
+
####I'm getting an error about a browser-like environment {/*im-getting-an-error-about-a-browser-like-environment*/}
680
678
681
679
`react-devtools-cdt-mcp/register` throws if it's imported outside a browser, for example during server rendering or in tests. Import it only from client-side code, or call `register()` from the package root yourself where it's safe.
682
680
683
-
### Source locations and owner stacks are empty {/*source-locations-and-owner-stacks-are-empty*/}
681
+
####Source locations and owner stacks are empty {/*source-locations-and-owner-stacks-are-empty*/}
684
682
685
683
This data only exists in development builds of React. Make sure you're running your app's development server rather than a production build.
686
684
687
-
### A uid stopped working {/*a-uid-stopped-working*/}
685
+
####A uid stopped working {/*a-uid-stopped-working*/}
688
686
689
687
Uids don't survive page reloads. After a reload, get fresh uids with `react_get_component_tree` or `react_find_components`.
0 commit comments