Skip to content

Commit 16b2f62

Browse files
author
Juan Tejada
committed
address comments
1 parent 10904e6 commit 16b2f62

File tree

3 files changed

+14
-18
lines changed

3 files changed

+14
-18
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ function createPanelIfReactLoaded() {
120120

121121
function onDuplicateExtensionMessage(message) {
122122
if (message === SHOW_DUPLICATE_EXTENSION_WARNING) {
123+
chrome.runtime.onMessage.removeListener(
124+
onDuplicateExtensionMessage,
125+
);
126+
123127
if (warnIfDuplicateInstallation === true) {
124128
return;
125129
}
@@ -134,14 +138,14 @@ function createPanelIfReactLoaded() {
134138
chrome.devtools.inspectedWindow.eval(
135139
`console.error("${errorMessage}")`,
136140
);
137-
render();
141+
if (render != null) {
142+
render();
143+
}
138144
}
139145
}
146+
chrome.runtime.onMessage.addListener(onDuplicateExtensionMessage);
140147

141148
function initBridgeAndStore() {
142-
chrome.runtime.onMessage.removeListener(onDuplicateExtensionMessage);
143-
chrome.runtime.onMessage.addListener(onDuplicateExtensionMessage);
144-
145149
const port = chrome.runtime.connect({
146150
name: String(tabId),
147151
});
@@ -398,7 +402,6 @@ function createPanelIfReactLoaded() {
398402
browserTheme: getBrowserTheme(),
399403
componentsPortalContainer,
400404
enabledInspectedElementContextMenu: true,
401-
isInternalBuild: EXTENSION_INSTALLATION_TYPE === 'internal',
402405
fetchFileWithCaching,
403406
hookNamesModuleLoaderFunction,
404407
overrideTab,

packages/react-devtools-shared/src/devtools/views/DevTools.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ export type Props = {|
7272
canViewElementSourceFunction?: ?CanViewElementSource,
7373
defaultTab?: TabID,
7474
enabledInspectedElementContextMenu?: boolean,
75-
isInternalBuild?: boolean,
7675
showTabBar?: boolean,
7776
store: Store,
7877
warnIfDuplicateInstallation?: boolean,
@@ -129,7 +128,6 @@ export default function DevTools({
129128
componentsPortalContainer,
130129
defaultTab = 'components',
131130
enabledInspectedElementContextMenu = false,
132-
isInternalBuild = false,
133131
fetchFileWithCaching,
134132
hookNamesModuleLoaderFunction,
135133
overrideTab,
@@ -324,11 +322,7 @@ export default function DevTools({
324322
</ViewElementSourceContext.Provider>
325323
</SettingsContextController>
326324
<UnsupportedBridgeProtocolDialog />
327-
{warnIfDuplicateInstallation && (
328-
<DuplicateInstallationDialog
329-
isInternalBuild={isInternalBuild}
330-
/>
331-
)}
325+
{warnIfDuplicateInstallation && <DuplicateInstallationDialog />}
332326
{warnIfLegacyBackendDetected && <WarnIfLegacyBackendDetected />}
333327
{warnIfUnsupportedVersionDetected && <UnsupportedVersionDialog />}
334328
</ModalDialogContextController>

packages/react-devtools-shared/src/devtools/views/DuplicateInstallationDialog.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@
99

1010
import * as React from 'react';
1111
import {Fragment, useContext, useEffect} from 'react';
12+
import {isInternalFacebookBuild} from 'react-devtools-feature-flags';
1213
import {ModalDialogContext} from './ModalDialog';
1314

14-
type Props = {|isInternalBuild: boolean|};
15-
16-
export default function DuplicateInstallationDialog(props: Props) {
15+
export default function DuplicateInstallationDialog(_: {||}) {
1716
const {dispatch} = useContext(ModalDialogContext);
1817

1918
useEffect(() => {
@@ -22,21 +21,21 @@ export default function DuplicateInstallationDialog(props: Props) {
2221
id: 'DuplicateInstallationDialog',
2322
type: 'SHOW',
2423
title: 'Duplicate Installations of DevTools Detected',
25-
content: <DialogContent isInternalBuild={props.isInternalBuild} />,
24+
content: <DialogContent />,
2625
});
2726
}, []);
2827
return null;
2928
}
3029

31-
function DialogContent(props: Props) {
30+
function DialogContent(_: {||}) {
3231
return (
3332
<Fragment>
3433
<p>
3534
We detected that there are multiple versions of React Developer Tools
3635
installed and enabled in your browser at the same time, which will cause
3736
issues while using the extension.
3837
</p>
39-
{props.isInternalBuild ? (
38+
{isInternalFacebookBuild ? (
4039
<p>
4140
Before proceeding, please ensure that the only enabled version of
4241
React Developer Tools is the internal (Chef-installed) version. To

0 commit comments

Comments
 (0)