Skip to content

Conversation

eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Sep 1, 2025

Apps streaming in server-rendered content will have hydrated content before the document is in an idle state. This means content may be interactive before document_end is reached or pageshow events are fired. However, the React tree may already be interesting to inspect. Especially larger apps in development can easily take multiple seconds before everything has streamed in.

React DevTools used to not display a Component tree before streaming had finished.

We need to start executing multiple things earlier to be able to inspect the React app as early as possible:

Once Firefox implements pagereveal, you'll be able to inspect the tree before loading has finished.

Test plan

soft navs, hard navs and backwards/forwards cache in Chrome and Firefox

Chrome manual testing
CleanShot.2025-09-04.at.11.33.09.mp4
Firefox manual testing
CleanShot.2025-09-04.at.11.27.17.mp4

@meta-cla meta-cla bot added the CLA Signed label Sep 1, 2025
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Sep 1, 2025
@react-sizebot
Copy link

react-sizebot commented Sep 1, 2025

Comparing: ba6590d...591a55f

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.js = 6.68 kB 6.68 kB = 1.83 kB 1.83 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 530.65 kB 530.65 kB = 93.49 kB 93.49 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.69 kB 6.69 kB = 1.83 kB 1.83 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 658.12 kB 658.12 kB = 115.77 kB 115.77 kB
facebook-www/ReactDOM-prod.classic.js = 682.25 kB 682.25 kB = 119.80 kB 119.80 kB
facebook-www/ReactDOM-prod.modern.js = 672.68 kB 672.68 kB = 118.11 kB 118.11 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against 591a55f

world: chrome.scripting.ExecutionWorld.ISOLATED,
},
{
id: '@react-devtools/file-fetcher',
js: ['build/fileFetcher.js'],
matches: ['<all_urls>'],
persistAcrossSessions: true,
runAt: 'document_end',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

file-fetcher script is probably best to keep initialized at document_end, no real need for it this early

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't that keep symbolication in a suspended state while we're still streaming in content?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but only as a last-resort option. The browser extension is using browser extensions API first to get resources from the page and only then falls back to the fetch call. To be fair, I am not even sure this still works, we are just relying that the resource is still cached somewhere in fetch implementation.

@hoxyq
Copy link
Contributor

hoxyq commented Sep 2, 2025

Could you also please test navigation between multiple pages while having DevTools open, incl. bfcache entries?

older chrome might also be an issue.
pagereveal is fairly new so we treat inspecting while
streaming as progressive enhancement.
@eps1lon eps1lon force-pushed the sebbie/09-01-_devtools_allow_inspection_before_streaming_has_finished branch from 445f6d6 to 591a55f Compare September 4, 2025 08:51
@eps1lon eps1lon requested a review from hoxyq September 4, 2025 09:36
@eps1lon eps1lon marked this pull request as ready for review September 4, 2025 09:36
Copy link
Contributor

@hoxyq hoxyq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it, thank you!

@eps1lon eps1lon merged commit 5a31758 into facebook:main Sep 4, 2025
244 checks passed
@eps1lon eps1lon deleted the sebbie/09-01-_devtools_allow_inspection_before_streaming_has_finished branch September 4, 2025 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants