From fd6e130b00d4d1fe211c75e981160131669c4412 Mon Sep 17 00:00:00 2001 From: Vitali Zaidman Date: Thu, 6 Jun 2024 17:48:44 +0100 Subject: [PATCH] Default native inspections config false (#29784) ## Summary To make the config `supportsNativeInspection` explicit, set it to default to `false` and only allow it in the extension. ## How did you test this change? When disabled on **React DevTools extension** Screenshot 2024-06-06 at 17 34 02 When enabled on **React DevTools extension** (the chosen config) Screenshot 2024-06-06 at 17 34 53 When enabled on **React DevTools in Fusebox** Screenshot 2024-06-06 at 17 29 24 When disabled on **React DevTools in Fusebox** (the chosen config) Screenshot 2024-06-06 at 17 30 31 When enabled on **React DevTools Inline** Screenshot 2024-06-06 at 17 24 20 When disabled on **React DevTools Inline** (the chosen config) Screenshot 2024-06-06 at 17 19 39 When enabled on **React DevTools standalone** Screenshot 2024-06-06 at 17 23 16 When disabled on **React DevTools standalone** (the chosen config) Screenshot 2024-06-06 at 17 19 39 --- packages/react-devtools-core/src/standalone.js | 1 - packages/react-devtools-extensions/src/main/index.js | 1 + packages/react-devtools-fusebox/src/frontend.js | 1 - packages/react-devtools-inline/src/frontend.js | 1 - packages/react-devtools-shared/src/devtools/store.js | 6 ++++-- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/react-devtools-core/src/standalone.js b/packages/react-devtools-core/src/standalone.js index 7eb246a28a316..e4e4ada1c31a9 100644 --- a/packages/react-devtools-core/src/standalone.js +++ b/packages/react-devtools-core/src/standalone.js @@ -279,7 +279,6 @@ function initialize(socket: WebSocket) { // $FlowFixMe[incompatible-call] found when upgrading Flow store = new Store(bridge, { checkBridgeProtocolCompatibility: true, - supportsNativeInspection: false, supportsTraceUpdates: true, }); diff --git a/packages/react-devtools-extensions/src/main/index.js b/packages/react-devtools-extensions/src/main/index.js index 224e4cd4b4a8a..e1db3d505577b 100644 --- a/packages/react-devtools-extensions/src/main/index.js +++ b/packages/react-devtools-extensions/src/main/index.js @@ -97,6 +97,7 @@ function createBridgeAndStore() { // At this time, the timeline can only parse Chrome performance profiles. supportsTimeline: __IS_CHROME__, supportsTraceUpdates: true, + supportsNativeInspection: true, }); if (!isProfiling) { diff --git a/packages/react-devtools-fusebox/src/frontend.js b/packages/react-devtools-fusebox/src/frontend.js index 68f5560bd9f98..976b8693d373e 100644 --- a/packages/react-devtools-fusebox/src/frontend.js +++ b/packages/react-devtools-fusebox/src/frontend.js @@ -37,7 +37,6 @@ export function createStore(bridge: FrontendBridge, config?: Config): Store { return new Store(bridge, { checkBridgeProtocolCompatibility: true, supportsTraceUpdates: true, - supportsNativeInspection: false, ...config, }); } diff --git a/packages/react-devtools-inline/src/frontend.js b/packages/react-devtools-inline/src/frontend.js index 35897b9407e59..9031f6ffc7bd7 100644 --- a/packages/react-devtools-inline/src/frontend.js +++ b/packages/react-devtools-inline/src/frontend.js @@ -23,7 +23,6 @@ export function createStore(bridge: FrontendBridge, config?: Config): Store { checkBridgeProtocolCompatibility: true, supportsTraceUpdates: true, supportsTimeline: true, - supportsNativeInspection: false, ...config, }); } diff --git a/packages/react-devtools-shared/src/devtools/store.js b/packages/react-devtools-shared/src/devtools/store.js index 3eb589b903dac..408151dcdbbaf 100644 --- a/packages/react-devtools-shared/src/devtools/store.js +++ b/packages/react-devtools-shared/src/devtools/store.js @@ -172,7 +172,7 @@ export default class Store extends EventEmitter<{ _rootIDToRendererID: Map = new Map(); // These options may be initially set by a configuration option when constructing the Store. - _supportsNativeInspection: boolean = true; + _supportsNativeInspection: boolean = false; _supportsReloadAndProfile: boolean = false; _supportsTimeline: boolean = false; _supportsTraceUpdates: boolean = false; @@ -216,7 +216,9 @@ export default class Store extends EventEmitter<{ supportsTimeline, supportsTraceUpdates, } = config; - this._supportsNativeInspection = supportsNativeInspection !== false; + if (supportsNativeInspection) { + this._supportsNativeInspection = true; + } if (supportsReloadAndProfile) { this._supportsReloadAndProfile = true; }