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
fix: fail tree observation without an attached app and replace re-flushed roots
Observation commands (get tree, get component, find, count, errors,
profile start) returned an empty result with exit 0 when no React app was
attached, so "No components with errors or warnings" was indistinguishable
from a check that never ran. They now fail with a typed `no-app-attached`
reason and a message that says whether an app ever connected.
When another React DevTools backend attaches to the same app (React Native
DevTools opening, another agent), react-devtools-core creates a fresh
renderer interface with a new fiber-ID space and flushes the whole tree
through the hook-wide operations channel every agent subscribes to. Later
commits reach only that new interface, so the daemon's existing root is
frozen, not merely duplicated. The bridge now asks the tree to reconcile a
second root on the same connection: a root that structurally duplicates an
older root of the same renderer replaces it; a genuinely different root is
kept.
Reported through callstack/agent-device#2430.
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -152,7 +152,7 @@ Components with errors or warnings are annotated in tree and search output:
152
152
@c5 [fn] Form ⚠2 ✗1
153
153
```
154
154
155
-
Use the `errors` command to list only components with issues:
155
+
Use the `errors` command to list only components with issues. When no app is attached, it exits 1 with `No React app is attached` rather than reporting a clean tree:
Copy file name to clipboardExpand all lines: packages/agent-react-devtools/skills/react-devtools/SKILL.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -167,7 +167,8 @@ agent-react-devtools status # Should show 1 connected app
167
167
## Important Rules
168
168
169
169
-**Labels reset** when the app reloads or components unmount/remount. After a reload, use `wait --connected` then re-check with `get tree` or `find`.
170
-
-**`status` first** — if status shows 0 connected apps, the React app is not connected. The user may need to run `npx agent-react-devtools init` in their project first.
170
+
-**`status` first** — if status shows 0 connected apps, the React app is not connected. The user may need to run `npx agent-react-devtools init` in their project first. Tree observation commands exit 1 with `No React app is attached` in that state; treat that as "nothing was observed", not as a clean result.
171
+
-**Another DevTools attaching reassigns IDs** — when React Native DevTools (or another agent) attaches to the same app, React re-flushes the tree under new IDs and the daemon replaces its copy. Re-run `get tree` or `find` before reusing earlier `@cN` labels.
171
172
-**Headed browser required** — if using `agent-browser`, always use `--headed` mode. Headless Chromium does not properly load the devtools connect script.
172
173
-**Profile while interacting** — profiling only captures renders that happen between `profile start` and `profile stop`. Make sure the relevant interaction happens during that window.
173
174
-**Use `--depth`** on large trees — a deep tree can produce a lot of output. Start with `--depth 3` or `--depth 4` and go deeper only on the subtree you care about.
Copy file name to clipboardExpand all lines: packages/agent-react-devtools/skills/react-devtools/references/commands.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,6 +65,8 @@ Output example:
65
65
66
66
`⚠N` = N warnings, `✗N` = N errors. Returns "No components with errors or warnings" when everything is clean.
67
67
68
+
When no React app is attached, this and every other tree observation command (`get tree`, `get component`, `find`, `count`, `profile start`) exits 1 with `No React app is attached to the DevTools daemon ...` instead of an empty result, so a missing app can never read as a clean pass.
69
+
68
70
Error/warning annotations also appear in `get tree`, `get component`, and `find` output when counts are non-zero.
0 commit comments