Repository navigation
Conversation
meta-codesync Bot
pushed a commit
to react/react-native
that referenced
this pull request
Oct 7, 2026
Summary: Notice: react/react-native-devtools-frontend#285 needs to land to display the human readable error properly in the disconnection dialog, but this fix works regardless. When a React Native host is destroyed while DevTools is attached (e.g. the app recreates its React Native instance), the DevTools frontend stayed open in a broken state: the console stopped receiving output, breakpoints were not respected, and no "disconnected" dialog was shown. Two issues combined: 1. `InspectorPackagerConnection` disconnected the local sessions when a page was removed, but the resulting `disconnect` notification was dropped because the session had already been erased, so the dev server was never told that the session ended. 2. The inspector proxy ignored device `disconnect` events for pages with the `nativePageReloads` capability, including connection rejections (e.g. when a debugger session is handed off to a reconnected device that no longer has the page), so the debugger WebSocket stayed open. This change: - Sends a `disconnect` event to the dev server for every session when a page is removed. - Closes the debugger connection in the inspector proxy with a new `[PAGE_REMOVED]` close reason when the device ends or rejects a session on a `nativePageReloads` page, so the frontend shows its disconnected dialog. - Adds a `DisconnectEventFromDevice` type with an optional `sessionId`, matching the documented protocol for legacy devices. - Adds a test ensuring all close reasons fit within the 123-byte WebSocket close frame limit. Changelog: [General][Fixed] - Fix React Native DevTools staying open but unresponsive after the debugged React Native instance is destroyed Differential Revision: D123882926
meta-codesync Bot
pushed a commit
to react/react-native
that referenced
this pull request
Oct 7, 2026
Summary: Notice: react/react-native-devtools-frontend#285 needs to land to display the human readable error properly in the disconnection dialog, but this fix works regardless. When a React Native host is destroyed while DevTools is attached (e.g. the app recreates its React Native instance), the DevTools frontend stayed open in a broken state: the console stopped receiving output, breakpoints were not respected, and no "disconnected" dialog was shown. Two issues combined: 1. `InspectorPackagerConnection` disconnected the local sessions when a page was removed, but the resulting `disconnect` notification was dropped because the session had already been erased, so the dev server was never told that the session ended. 2. The inspector proxy ignored device `disconnect` events for pages with the `nativePageReloads` capability, including connection rejections (e.g. when a debugger session is handed off to a reconnected device that no longer has the page), so the debugger WebSocket stayed open. This change: - Sends a `disconnect` event to the dev server for every session when a page is removed. - Closes the debugger connection in the inspector proxy with a new `[PAGE_REMOVED]` close reason when the device ends or rejects a session on a `nativePageReloads` page, so the frontend shows its disconnected dialog. - Adds a `DisconnectEventFromDevice` type with an optional `sessionId`, matching the documented protocol for legacy devices. - Adds a test ensuring all close reasons fit within the 123-byte WebSocket close frame limit. Changelog: [General][Fixed] - Fix React Native DevTools staying open but unresponsive after the debugged React Native instance is destroyed Differential Revision: D123882926
meta-codesync Bot
pushed a commit
to react/react-native
that referenced
this pull request
Oct 7, 2026
Summary: Pull Request resolved: #58927 Notice: react/react-native-devtools-frontend#285 needs to land to display the human readable error properly in the disconnection dialog, but this fix works regardless. When a React Native host is destroyed while DevTools is attached (e.g. the app recreates its React Native instance), the DevTools frontend stayed open in a broken state: the console stopped receiving output, breakpoints were not respected, and no "disconnected" dialog was shown. Two issues combined: 1. `InspectorPackagerConnection` disconnected the local sessions when a page was removed, but the resulting `disconnect` notification was dropped because the session had already been erased, so the dev server was never told that the session ended. 2. The inspector proxy ignored device `disconnect` events for pages with the `nativePageReloads` capability, including connection rejections (e.g. when a debugger session is handed off to a reconnected device that no longer has the page), so the debugger WebSocket stayed open. This change: - Sends a `disconnect` event to the dev server for every session when a page is removed. - Closes the debugger connection in the inspector proxy with a new `[PAGE_REMOVED]` close reason when the device ends or rejects a session on a `nativePageReloads` page, so the frontend shows its disconnected dialog. - Adds a `DisconnectEventFromDevice` type with an optional `sessionId`, matching the documented protocol for legacy devices. - Adds a test ensuring all close reasons fit within the 123-byte WebSocket close frame limit. Changelog: [General][Fixed] - Fix React Native DevTools staying open but unresponsive after the debugged React Native instance is destroyed Differential Revision: D123882926
meta-codesync Bot
pushed a commit
to react/react-native
that referenced
this pull request
Oct 8, 2026
Summary: Notice: react/react-native-devtools-frontend#285 needs to land to display the human readable error properly in the disconnection dialog, but this fix works regardless. When a React Native host is destroyed while DevTools is attached (e.g. the app recreates its React Native instance), the DevTools frontend stayed open in a broken state: the console stopped receiving output, breakpoints were not respected, and no "disconnected" dialog was shown. Two issues combined: 1. `InspectorPackagerConnection` disconnected the local sessions when a page was removed, but the resulting `disconnect` notification was dropped because the session had already been erased, so the dev server was never told that the session ended. 2. The inspector proxy ignored device `disconnect` events for pages with the `nativePageReloads` capability, including connection rejections (e.g. when a debugger session is handed off to a reconnected device that no longer has the page), so the debugger WebSocket stayed open. This change: - Sends a `disconnect` event to the dev server for every session when a page is removed. - Closes the debugger connection in the inspector proxy with a new `[PAGE_REMOVED]` close reason when the device ends or rejects a session on a `nativePageReloads` page, so the frontend shows its disconnected dialog. - Adds a `DisconnectEventFromDevice` type with an optional `sessionId`, matching the documented protocol for legacy devices. - Adds a test ensuring all close reasons fit within the 123-byte WebSocket close frame limit. Changelog: [General][Fixed] - Fix React Native DevTools staying open but unresponsive after the debugged React Native instance is destroyed Differential Revision: D123882926
meta-codesync Bot
pushed a commit
to react/react-native
that referenced
this pull request
Oct 8, 2026
Summary: Pull Request resolved: #58927 Notice: react/react-native-devtools-frontend#285 needs to land to display the human readable error properly in the disconnection dialog, but this fix works regardless. When a React Native host is destroyed while DevTools is attached (e.g. the app recreates its React Native instance), the DevTools frontend stayed open in a broken state: the console stopped receiving output, breakpoints were not respected, and no "disconnected" dialog was shown. Two issues combined: 1. `InspectorPackagerConnection` disconnected the local sessions when a page was removed, but the resulting `disconnect` notification was dropped because the session had already been erased, so the dev server was never told that the session ended. 2. The inspector proxy ignored device `disconnect` events for pages with the `nativePageReloads` capability, including connection rejections (e.g. when a debugger session is handed off to a reconnected device that no longer has the page), so the debugger WebSocket stayed open. This change: - Sends a `disconnect` event to the dev server for every session when a page is removed. - Closes the debugger connection in the inspector proxy with a new `[PAGE_REMOVED]` close reason when the device ends or rejects a session on a `nativePageReloads` page, so the frontend shows its disconnected dialog. - Adds a `DisconnectEventFromDevice` type with an optional `sessionId`, matching the documented protocol for legacy devices. - Adds a test ensuring all close reasons fit within the 123-byte WebSocket close frame limit. Changelog: [General][Fixed] - Fix React Native DevTools staying open but unresponsive after the debugged React Native instance is destroyed Differential Revision: D123882926
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a React Native instance is destroyed while DevTools is attached, the inspector proxy closes the debugger connection with the
[PAGE_REMOVED]close reason (D123882926). Map it to a user-facing message in the disconnected dialog instead of the generic "WebSocket disconnected".Test plan
See D123882926
Built the frontend, ran Metro with
REACT_NATIVE_DEBUGGER_FRONTEND_PATHpointing at the local build and the dev-middleware/native changes from D123882926, destroyed the React Native instance while DevTools was attached, and verified the dialog shows "The React Native instance being debugged no longer exists. Relaunch DevTools to debug a new instance."Upstreaming plan
devtools-frontendrepo following the contribution guide for Meta employees OR contribution guide.