From fd693a4777d19e2b8744a5d75e9a3cc444d4d2e8 Mon Sep 17 00:00:00 2001 From: Ruslan Lesiutin Date: Tue, 10 Jun 2025 22:29:24 +0100 Subject: [PATCH] chore: hide unsupported Detached elements memory profiling option --- front_end/panels/profiler/HeapProfilerPanel.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/front_end/panels/profiler/HeapProfilerPanel.ts b/front_end/panels/profiler/HeapProfilerPanel.ts index b25d9e65fc9..36d70e25b72 100644 --- a/front_end/panels/profiler/HeapProfilerPanel.ts +++ b/front_end/panels/profiler/HeapProfilerPanel.ts @@ -4,6 +4,7 @@ import * as Host from '../../core/host/host.js'; import * as i18n from '../../core/i18n/i18n.js'; +import * as Root from '../../core/root/root.js'; import type * as SDK from '../../core/sdk/sdk.js'; import * as UI from '../../ui/legacy/legacy.js'; @@ -24,8 +25,17 @@ let heapProfilerPanelInstance: HeapProfilerPanel; export class HeapProfilerPanel extends ProfilesPanel implements UI.ContextMenu.Provider, UI.ActionRegistration.ActionDelegate { constructor() { + const isReactNative = Root.Runtime.experiments.isEnabled( + Root.Runtime.ExperimentName.REACT_NATIVE_SPECIFIC_UI, + ); const registry = instance; - const profileTypes = [ + // [RN] Allocation sampling and Detached elements memory profiling options are not supported. + // We are hiding these options from the UI. + const profileTypes = isReactNative ? [ + registry.heapSnapshotProfileType, + registry.trackingHeapSnapshotProfileType, + registry.samplingHeapProfileType, + ] : [ registry.heapSnapshotProfileType, registry.trackingHeapSnapshotProfileType, registry.samplingHeapProfileType,