Skip to content

Commit 3c20e0c

Browse files
committed
[DevTools] Separate RDT Fusebox into single-panel entry points
1 parent 2a54019 commit 3c20e0c

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

packages/react-devtools-fusebox/src/frontend.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,5 @@ export type InitializationOptions = {
5050
canViewElementSourceFunction?: CanViewElementSource,
5151
};
5252

53-
export function initialize(node: Element | Document, options: InitializationOptions): void;
53+
export function initializeComponents(node: Element | Document, options: InitializationOptions): void;
54+
export function initializeProfiler(node: Element | Document, options: InitializationOptions): void;

packages/react-devtools-fusebox/src/frontend.js

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ import type {
1919
} from 'react-devtools-shared/src/frontend/types';
2020
import type {FrontendBridge} from 'react-devtools-shared/src/bridge';
2121
import type {
22+
CanViewElementSource,
23+
TabID,
2224
ViewAttributeSource,
2325
ViewElementSource,
24-
CanViewElementSource,
2526
} from 'react-devtools-shared/src/devtools/views/DevTools';
2627
import type {Config} from 'react-devtools-shared/src/devtools/store';
2728

@@ -51,10 +52,11 @@ type InitializationOptions = {
5152
canViewElementSourceFunction?: CanViewElementSource,
5253
};
5354

54-
export function initialize(
55+
function initializeTab(
56+
tab: TabID,
5557
contentWindow: Element | Document,
5658
options: InitializationOptions,
57-
): void {
59+
) {
5860
const {
5961
bridge,
6062
store,
@@ -70,7 +72,8 @@ export function initialize(
7072
bridge={bridge}
7173
browserTheme={theme}
7274
store={store}
73-
showTabBar={true}
75+
showTabBar={false}
76+
overrideTab={tab}
7477
warnIfLegacyBackendDetected={true}
7578
enabledInspectedElementContextMenu={true}
7679
viewAttributeSourceFunction={viewAttributeSourceFunction}
@@ -79,3 +82,17 @@ export function initialize(
7982
/>,
8083
);
8184
}
85+
86+
export function initializeComponents(
87+
contentWindow: Element | Document,
88+
options: InitializationOptions,
89+
): void {
90+
initializeTab('components', contentWindow, options);
91+
}
92+
93+
export function initializeProfiler(
94+
contentWindow: Element | Document,
95+
options: InitializationOptions,
96+
): void {
97+
initializeTab('profiler', contentWindow, options);
98+
}

0 commit comments

Comments
 (0)