diff --git a/front_end/entrypoints/rn_fusebox/FuseboxExperimentsObserver.ts b/front_end/entrypoints/rn_fusebox/FuseboxExperimentsObserver.ts index cc24c6a503b..f560156ed06 100644 --- a/front_end/entrypoints/rn_fusebox/FuseboxExperimentsObserver.ts +++ b/front_end/entrypoints/rn_fusebox/FuseboxExperimentsObserver.ts @@ -62,17 +62,28 @@ export default class FuseboxFeatureObserver implements } #hideUnsupportedFeaturesForProfilingBuilds(): void { - UI.ViewManager.ViewManager.instance() - .resolveLocation(UI.ViewManager.ViewLocationValues.PANEL) - .then(location => { + UI.InspectorView.InspectorView.instance().closeDrawer(); + + const viewManager = UI.ViewManager.ViewManager.instance(); + const panelLocationPromise = viewManager.resolveLocation(UI.ViewManager.ViewLocationValues.PANEL); + const drawerLocationPromise = viewManager.resolveLocation(UI.ViewManager.ViewLocationValues.DRAWER_VIEW); + void Promise.all([panelLocationPromise, drawerLocationPromise]) + .then(([panelLocation, drawerLocation]) => { UI.ViewManager.getRegisteredViewExtensions().forEach(view => { - switch (view.viewId()) { - case 'sources': - case 'network': - case 'react-devtools-components': - case 'react-devtools-profiler': - location?.removeView(view); - break; + if (view.location() === UI.ViewManager.ViewLocationValues.DRAWER_VIEW) { + drawerLocation?.removeView(view); + } else { + switch (view.viewId()) { + case 'console': + case 'heap-profiler': + case 'live-heap-profile': + case 'sources': + case 'network': + case 'react-devtools-components': + case 'react-devtools-profiler': + panelLocation?.removeView(view); + break; + } } }); }); diff --git a/front_end/panels/rn_welcome/RNWelcome.ts b/front_end/panels/rn_welcome/RNWelcome.ts index 73652bf6221..22028513398 100644 --- a/front_end/panels/rn_welcome/RNWelcome.ts +++ b/front_end/panels/rn_welcome/RNWelcome.ts @@ -60,6 +60,7 @@ export class RNWelcomeImpl extends UI.Widget.VBox implements private readonly options: RNWelcomeOptions; #reactNativeVersion: string|undefined; + #isProfilingBuild: boolean = false; static instance(options: RNWelcomeOptions): RNWelcomeImpl { if (!rnWelcomeImplInstance) { @@ -81,14 +82,19 @@ export class RNWelcomeImpl extends UI.Widget.VBox implements super.wasShown(); this.registerCSSFiles([rnWelcomeStyles]); this.render(); - UI.InspectorView.InspectorView.instance().showDrawer({focus: true, hasTargetDrawer: false}); + + if (!this.#isProfilingBuild) { + UI.InspectorView.InspectorView.instance().showDrawer({focus: true, hasTargetDrawer: false}); + } } modelAdded(model: SDK.ReactNativeApplicationModel.ReactNativeApplicationModel): void { model.ensureEnabled(); model.addEventListener( SDK.ReactNativeApplicationModel.Events.MetadataUpdated, this.#handleMetadataUpdated, this); + this.#reactNativeVersion = model.metadataCached?.reactNativeVersion; + this.#isProfilingBuild = model.metadataCached?.unstable_isProfilingBuild || false; } modelRemoved(model: SDK.ReactNativeApplicationModel.ReactNativeApplicationModel): void { @@ -99,6 +105,7 @@ export class RNWelcomeImpl extends UI.Widget.VBox implements #handleMetadataUpdated( event: Common.EventTarget.EventTargetEvent): void { this.#reactNativeVersion = event.data.reactNativeVersion; + this.#isProfilingBuild = event.data.unstable_isProfilingBuild || false; if (this.isShowing()) { this.render(); @@ -136,7 +143,7 @@ export class RNWelcomeImpl extends UI.Widget.VBox implements ).toString(); const launchId = Root.Runtime.Runtime.queryParam('launchId'); - + render(html`