You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 039e38b
Browse filesBrowse the repository at this point in the historyBrowse files
Close DevTools sessions when the debugged page is removed (#58927)
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
Copy file name to clipboardExpand all lines: packages/react-native/ReactCommon/jsinspector-modern/tests/InspectorPackagerConnectionMultiSessionTest.cpp
0 commit comments