dillon1000/react

Commit

[DevTools] Reset extension backend on pagehide (#37155)

I have noticed inconsistency errors being thrown during browser
navigations that involve entries from BFCache. The main argument on why
this could be affecting React DevTools backend lifecycle is the fact
that Chrome kills the port manually, while freezing and preserving the
JavaScript heap -
https://developer.chrome.com/blog/bfcache-extension-messaging-changes.

Basically, we could end up in a permutation, where port is dead, but
Backend / Agent are alive. Such setup is not expected by React DevTools.

On `main`:


https://github.com/user-attachments/assets/9ca10286-b545-4384-bd6b-33d9a4ddde3d


With these changes:


https://github.com/user-attachments/assets/c4639c4a-6385-4248-a5c4-a39895d7fff6


I couldn't come up with a good test for this yet, but I will try to add
something. I am not convinced yet that emulating `pagehide` / `pageshow`
would be sufficient to reproduce browser environment during BFCache
entries.
Browse files
Changed paths2 files
First-parent comparison
M packages/react-devtools-extensions/src/contentScripts/backendManager.js ModifiedM packages/react-devtools-extensions/src/contentScripts/proxy.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…