Skip to content

[DevTools] Don't connect to pages that are being prerendered#35958

Merged
eps1lon merged 1 commit intofacebook:mainfrom
eps1lon:sebbie/03-04-_devtools_don_t_connect_to_pages_that_are_being_prerendered
Mar 4, 2026
Merged

[DevTools] Don't connect to pages that are being prerendered#35958
eps1lon merged 1 commit intofacebook:mainfrom
eps1lon:sebbie/03-04-_devtools_don_t_connect_to_pages_that_are_being_prerendered

Conversation

@eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Mar 4, 2026

Summary

Fixes #35954

Root cause was ping-ponging the proxy connection between the actual page and the prerendered page. Both were battling for the same tab ID.

We'll see if pageshow firing while prerendering is actually a bug but even if, it'll take some time to get fixed so we should work around that.

How did you test this change?

@meta-cla meta-cla bot added the CLA Signed label Mar 4, 2026
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Mar 4, 2026
@eps1lon eps1lon changed the title Sebbie/03 04 devtools don t connect to pages that are being prerendered [DevTools] Don't connect to pages that are being prerendered Mar 4, 2026
@react-sizebot
Copy link

react-sizebot commented Mar 4, 2026

Comparing: 4b568a8...e6ee9ca

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.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-stable/react-dom/cjs/react-dom-client.production.js = 611.79 kB 611.79 kB = 108.12 kB 108.11 kB
oss-experimental/react-dom/cjs/react-dom.production.js = 6.84 kB 6.84 kB = 1.88 kB 1.88 kB
oss-experimental/react-dom/cjs/react-dom-client.production.js = 677.72 kB 677.72 kB = 119.08 kB 119.08 kB
facebook-www/ReactDOM-prod.classic.js = 697.67 kB 697.67 kB = 122.58 kB 122.58 kB
facebook-www/ReactDOM-prod.modern.js = 687.98 kB 687.98 kB = 120.96 kB 120.96 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against e6ee9ca

@eps1lon eps1lon force-pushed the sebbie/03-04-_devtools_don_t_connect_to_pages_that_are_being_prerendered branch from 95c1af9 to e6ee9ca Compare March 4, 2026 11:51
@eps1lon eps1lon requested a review from hoxyq March 4, 2026 12:28
@eps1lon eps1lon marked this pull request as ready for review March 4, 2026 12:29
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.

We should probably look into replacing the ping-pong mechanism with some subscription or event emitter mechanism, instead

Been receiving a lot of reports that it is causing high CPU usage across non-React surfaces

@eps1lon
Copy link
Collaborator Author

eps1lon commented Mar 4, 2026

Yeah, that file looks also (memory-)leaky at the moment.

Been receiving a lot of reports that it is causing high CPU usage across non-React surfaces

I wonder if that's all from not handling document.prerendering i.e. pages having speculation rules. That would also affect typing in Chrome's omnibox or hovering bookmarks because those can kick of prerendering as well.

@eps1lon eps1lon merged commit 23b2d85 into facebook:main Mar 4, 2026
241 checks passed
@eps1lon eps1lon deleted the sebbie/03-04-_devtools_don_t_connect_to_pages_that_are_being_prerendered branch March 4, 2026 12:45
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.

[DevTools Bug]: confused on prerender pages and resulting in high-cpu usage loop

3 participants