Visitar URL original
[react] Pick the react-dom renderer instead of hardcoding renderer id 1 by gaojude · Pull Request #1491 · vercel-labs/agent-browser · GitHub
Skip to content

[react] Pick the react-dom renderer instead of hardcoding renderer id 1 - #1491

Merged
ctate merged 1 commit into
mainfrom
worktree-react-renderer-fix
Jun 26, 2026
Merged

ctate merged 1 commit into
mainfrom
worktree-react-renderer-fix

Conversation

@gaojude

@gaojude gaojude commented Jun 26, 2026

Copy link
Copy Markdown

react tree, react inspect, and react suspense read hook.rendererInterfaces.get(1), assuming react-dom is the first renderer to call inject(). In Turbopack RSC apps (Next.js 16.3+) the react-server-dom-turbopack Flight client registers first as id 1 with zero fiber roots, so the commands walked an empty interface and silently reported nothing — react suspense returned "0 boundaries" and react tree came back empty even though the app tree was fully mounted on renderer 2.

A shared __abPickReactRendererId helper, injected via a {{PICK_RI}} placeholder, now selects the first non-Flight renderer with mounted fiber roots (falling back to any renderer with roots, then any renderer), and the chosen id is used for inspectElement too. Adds unit tests asserting the scripts inject the picker and no longer hardcode renderer id 1.

`react tree`, `react inspect`, and `react suspense` read
`hook.rendererInterfaces.get(1)`, assuming the first renderer to call
`hook.inject()` is react-dom. In Turbopack RSC apps (e.g. Next.js 16.3+)
the `react-server-dom-turbopack` Flight client registers first as id 1
with zero fiber roots, so `get(1)` walked an empty interface and every
command silently reported nothing (`react suspense` -> "0 boundaries",
`react tree` -> empty).

Introduce a shared `__abPickReactRendererId` helper, injected via a
`{{PICK_RI}}` placeholder, that selects the first non-Flight renderer
with mounted fiber roots (falling back to any renderer with roots, then
any renderer). Use the chosen id for `inspectElement` as well.

Add unit tests asserting the scripts inject the picker and no longer
hardcode renderer id 1.
@vercel

vercel Bot commented Jun 26, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-browser Ready Ready Preview, Comment Jun 26, 2026 4:28pm
agent-browser-env-demo Ready Ready Preview, Comment Jun 26, 2026 4:28pm

@gaojude
gaojude requested a review from ctate June 26, 2026 16:32
@ctate
ctate merged commit 61429b8 into main Jun 26, 2026
14 checks passed
@gaojude gaojude mentioned this pull request Jun 26, 2026
leeguooooo added a commit to leeguooooo/chrome-use that referenced this pull request Jul 1, 2026
Ported from vercel-labs/agent-browser vercel-labs#1491. Our react tree/inspect/suspense
scripts hardcoded rendererInterfaces.get(1); on Turbopack RSC apps (Next.js
16.3+) the react-server-dom Flight client registers first as id 1 with zero
fiber roots, so every `react` command read an empty tree. Now inject a shared
__abPickReactRendererId helper that picks the first non-Flight renderer with
mounted roots. Guarded by a unit test.

(Upstream vercel-labs#1483 wait --url globbing is already covered by our url_glob_to_regex.)
leeguooooo added a commit to leeguooooo/chrome-use that referenced this pull request Sep 15, 2026
Ported from vercel-labs/agent-browser vercel-labs#1491. Our react tree/inspect/suspense
scripts hardcoded rendererInterfaces.get(1); on Turbopack RSC apps (Next.js
16.3+) the react-server-dom Flight client registers first as id 1 with zero
fiber roots, so every `react` command read an empty tree. Now inject a shared
__abPickReactRendererId helper that picks the first non-Flight renderer with
mounted roots. Guarded by a unit test.

(Upstream vercel-labs#1483 wait --url globbing is already covered by our url_glob_to_regex.)
tahodev pushed a commit to tahodev/agent-browser that referenced this pull request Oct 20, 2026
…ercel-labs#1491)

`react tree`, `react inspect`, and `react suspense` read
`hook.rendererInterfaces.get(1)`, assuming the first renderer to call
`hook.inject()` is react-dom. In Turbopack RSC apps (e.g. Next.js 16.3+)
the `react-server-dom-turbopack` Flight client registers first as id 1
with zero fiber roots, so `get(1)` walked an empty interface and every
command silently reported nothing (`react suspense` -> "0 boundaries",
`react tree` -> empty).

Introduce a shared `__abPickReactRendererId` helper, injected via a
`{{PICK_RI}}` placeholder, that selects the first non-Flight renderer
with mounted fiber roots (falling back to any renderer with roots, then
any renderer). Use the chosen id for `inspectElement` as well.

Add unit tests asserting the scripts inject the picker and no longer
hardcode renderer id 1.

This branch was successfully deployed

2 active deployments
Preview – agent-browser — b4d566e8 Deployed Jun 26, 2026 by vercel[bot]
Preview – agent-browser-env-demo — b4d566e8 Deployed Jun 26, 2026 by vercel[bot]
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.

2 participants