[DevTools] The bridge event types should only be defined in one direction (#34859)
This revealed that a lot of the event types were defined on the wrong end of the bridge. It was also a problem that events with the same name couldn't have different arguments.
Sebastian Markbåge committed
Oct 15, 2025 at 11:42 UTC
1873ad7960da8fd8d497d03da8050ad88b8bcacf
2 files changed
+11
-12
packages/react-devtools-shared/src/bridge.js
+10
-11
@@ -217,10 +217,15 @@ export type BackendEvents = {
217
selectElement: [number],
218
shutdown: [],
219
stopInspectingHost: [boolean],
220
- syncSelectionFromBuiltinElementsPanel: [],
220
syncSelectionToBuiltinElementsPanel: [],
221
unsupportedRendererVersion: [],
222
223
+ extensionComponentsPanelShown: [],
224
+ extensionComponentsPanelHidden: [],
225
+
226
+ resumeElementPolling: [],
227
+ pauseElementPolling: [],
228
+
229
// React Native style editor plug-in.
230
isNativeStyleEditorSupported: [
231
{isSupported: boolean, validAttributes: ?$ReadOnlyArray<string>},
@@ -240,8 +245,6 @@ type FrontendEvents = {
245
clearWarningsForElementID: [ElementAndRendererID],
246
copyElementPath: [CopyElementPathParams],
247
deletePath: [DeletePath],
243
- extensionComponentsPanelShown: [],
244
- extensionComponentsPanelHidden: [],
248
getBackendVersion: [],
249
getBridgeProtocol: [],
250
getIfHasUnsupportedRendererVersion: [],
@@ -265,7 +268,7 @@ type FrontendEvents = {
268
shutdown: [],
269
startInspectingHost: [],
270
startProfiling: [StartProfilingParams],
268
- stopInspectingHost: [boolean],
271
+ stopInspectingHost: [],
272
scrollToHostInstance: [ScrollToHostInstance],
273
stopProfiling: [],
274
storeAsGlobal: [StoreAsGlobalParams],
@@ -275,6 +278,8 @@ type FrontendEvents = {
278
viewAttributeSource: [ViewAttributeSourceParams],
279
viewElementSource: [ElementAndRendererID],
280
281
+ syncSelectionFromBuiltinElementsPanel: [],
282
+
283
// React Native style editor plug-in.
284
NativeStyleEditor_measure: [ElementAndRendererID],
285
NativeStyleEditor_renameAttribute: [NativeStyleEditor_RenameAttributeParams],
@@ -295,19 +300,13 @@ type FrontendEvents = {
300
overrideProps: [OverrideValue],
301
overrideState: [OverrideValue],
302
298
- resumeElementPolling: [],
299
- pauseElementPolling: [],
300
-
303
getHookSettings: [],
304
};
305
306
class Bridge<
307
OutgoingEvents: Object,
308
IncomingEvents: Object,
307
-> extends EventEmitter<{
308
- ...IncomingEvents,
309
- ...OutgoingEvents,
310
-}> {
309
+> extends EventEmitter<IncomingEvents> {
310
_isShutdown: boolean = false;
311
_messageQueue: Array<any> = [];
312
_scheduledFlush: boolean = false;
packages/react-devtools-shared/src/devtools/views/Components/InspectHostNodesToggle.js
+1
-1
@@ -26,7 +26,7 @@ export default function InspectHostNodesToggle(): React.Node {
26
logEvent({event_name: 'inspect-element-button-clicked'});
27
bridge.send('startInspectingHost');
28
} else {
29
- bridge.send('stopInspectingHost', false);
29
+ bridge.send('stopInspectingHost');
30
}
31
},
32
[bridge],