Skip to content

Commit c34a172

Browse files
committed
fix[react-devtools] divided inspecting elements between inspecting dom elements from matching dev tools elements and nav to dev tool elements on page click
1 parent 814a418 commit c34a172

File tree

6 files changed

+23
-10
lines changed

6 files changed

+23
-10
lines changed

packages/react-devtools-core/src/standalone.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ function initialize(socket: WebSocket) {
280280
store = new Store(bridge, {
281281
checkBridgeProtocolCompatibility: true,
282282
supportsTraceUpdates: true,
283+
supportsClickToInspect: true,
283284
});
284285

285286
log('Connected');

packages/react-devtools-extensions/src/main/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ function createBridgeAndStore() {
9797
// At this time, the timeline can only parse Chrome performance profiles.
9898
supportsTimeline: __IS_CHROME__,
9999
supportsTraceUpdates: true,
100-
supportsNativeInspection: true,
100+
supportsInspectMatchingDOMElement: true,
101+
supportsClickToInspect: true,
101102
});
102103

103104
if (!isProfiling) {

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export function createStore(bridge: FrontendBridge, config?: Config): Store {
3737
return new Store(bridge, {
3838
checkBridgeProtocolCompatibility: true,
3939
supportsTraceUpdates: true,
40+
supportsClickToInspect: true,
4041
...config,
4142
});
4243
}

packages/react-devtools-shared/src/devtools/store.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ type ErrorAndWarningTuples = Array<{id: number, index: number}>;
7171
export type Config = {
7272
checkBridgeProtocolCompatibility?: boolean,
7373
isProfiling?: boolean,
74-
supportsNativeInspection?: boolean,
74+
supportsInspectMatchingDOMElement?: boolean,
75+
supportsClickToInspect?: boolean,
7576
supportsReloadAndProfile?: boolean,
7677
supportsTimeline?: boolean,
7778
supportsTraceUpdates?: boolean,
@@ -172,7 +173,8 @@ export default class Store extends EventEmitter<{
172173
_rootIDToRendererID: Map<number, number> = new Map();
173174

174175
// These options may be initially set by a configuration option when constructing the Store.
175-
_supportsNativeInspection: boolean = false;
176+
_supportsInspectMatchingDOMElement: boolean = false;
177+
_supportsClickToInspect: boolean = false;
176178
_supportsReloadAndProfile: boolean = false;
177179
_supportsTimeline: boolean = false;
178180
_supportsTraceUpdates: boolean = false;
@@ -211,13 +213,17 @@ export default class Store extends EventEmitter<{
211213
isProfiling = config.isProfiling === true;
212214

213215
const {
214-
supportsNativeInspection,
216+
supportsInspectMatchingDOMElement,
217+
supportsClickToInspect,
215218
supportsReloadAndProfile,
216219
supportsTimeline,
217220
supportsTraceUpdates,
218221
} = config;
219-
if (supportsNativeInspection) {
220-
this._supportsNativeInspection = true;
222+
if (supportsInspectMatchingDOMElement) {
223+
this._supportsInspectMatchingDOMElement = true;
224+
}
225+
if (supportsClickToInspect) {
226+
this._supportsClickToInspect = true;
221227
}
222228
if (supportsReloadAndProfile) {
223229
this._supportsReloadAndProfile = true;
@@ -437,8 +443,12 @@ export default class Store extends EventEmitter<{
437443
return this._rootSupportsTimelineProfiling;
438444
}
439445

440-
get supportsNativeInspection(): boolean {
441-
return this._supportsNativeInspection;
446+
get supportsInspectMatchingDOMElement(): boolean {
447+
return this._supportsInspectMatchingDOMElement;
448+
}
449+
450+
get supportsClickToInspect(): boolean {
451+
return this._supportsClickToInspect;
442452
}
443453

444454
get supportsNativeStyleEditor(): boolean {

packages/react-devtools-shared/src/devtools/views/Components/InspectedElement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export default function InspectedElementWrapper(_: Props): React.Node {
296296
<ButtonIcon type="suspend" />
297297
</Toggle>
298298
)}
299-
{store.supportsNativeInspection && (
299+
{store.supportsInspectMatchingDOMElement && (
300300
<Button
301301
onClick={highlightElement}
302302
title="Inspect the matching DOM element">

packages/react-devtools-shared/src/devtools/views/Components/Tree.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ export default function Tree(props: Props): React.Node {
361361
<TreeFocusedContext.Provider value={treeFocused}>
362362
<div className={styles.Tree} ref={treeRef}>
363363
<div className={styles.SearchInput}>
364-
{store.supportsNativeInspection && (
364+
{store.supportsClickToInspect && (
365365
<Fragment>
366366
<InspectHostNodesToggle />
367367
<div className={styles.VRule} />

0 commit comments

Comments
 (0)