From 16b2f6238b688cc3ab0bc2d65eb703883763fb99 Mon Sep 17 00:00:00 2001 From: Juan Tejada Date: Fri, 15 Oct 2021 10:56:14 -0400 Subject: [PATCH] address comments --- packages/react-devtools-extensions/src/main.js | 13 ++++++++----- .../src/devtools/views/DevTools.js | 8 +------- .../devtools/views/DuplicateInstallationDialog.js | 11 +++++------ 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/packages/react-devtools-extensions/src/main.js b/packages/react-devtools-extensions/src/main.js index ac73468dad647..5203b511035d5 100644 --- a/packages/react-devtools-extensions/src/main.js +++ b/packages/react-devtools-extensions/src/main.js @@ -120,6 +120,10 @@ function createPanelIfReactLoaded() { function onDuplicateExtensionMessage(message) { if (message === SHOW_DUPLICATE_EXTENSION_WARNING) { + chrome.runtime.onMessage.removeListener( + onDuplicateExtensionMessage, + ); + if (warnIfDuplicateInstallation === true) { return; } @@ -134,14 +138,14 @@ function createPanelIfReactLoaded() { chrome.devtools.inspectedWindow.eval( `console.error("${errorMessage}")`, ); - render(); + if (render != null) { + render(); + } } } + chrome.runtime.onMessage.addListener(onDuplicateExtensionMessage); function initBridgeAndStore() { - chrome.runtime.onMessage.removeListener(onDuplicateExtensionMessage); - chrome.runtime.onMessage.addListener(onDuplicateExtensionMessage); - const port = chrome.runtime.connect({ name: String(tabId), }); @@ -398,7 +402,6 @@ function createPanelIfReactLoaded() { browserTheme: getBrowserTheme(), componentsPortalContainer, enabledInspectedElementContextMenu: true, - isInternalBuild: EXTENSION_INSTALLATION_TYPE === 'internal', fetchFileWithCaching, hookNamesModuleLoaderFunction, overrideTab, diff --git a/packages/react-devtools-shared/src/devtools/views/DevTools.js b/packages/react-devtools-shared/src/devtools/views/DevTools.js index 497db5517271c..8f1b6a22c11bc 100644 --- a/packages/react-devtools-shared/src/devtools/views/DevTools.js +++ b/packages/react-devtools-shared/src/devtools/views/DevTools.js @@ -72,7 +72,6 @@ export type Props = {| canViewElementSourceFunction?: ?CanViewElementSource, defaultTab?: TabID, enabledInspectedElementContextMenu?: boolean, - isInternalBuild?: boolean, showTabBar?: boolean, store: Store, warnIfDuplicateInstallation?: boolean, @@ -129,7 +128,6 @@ export default function DevTools({ componentsPortalContainer, defaultTab = 'components', enabledInspectedElementContextMenu = false, - isInternalBuild = false, fetchFileWithCaching, hookNamesModuleLoaderFunction, overrideTab, @@ -324,11 +322,7 @@ export default function DevTools({ - {warnIfDuplicateInstallation && ( - - )} + {warnIfDuplicateInstallation && } {warnIfLegacyBackendDetected && } {warnIfUnsupportedVersionDetected && } diff --git a/packages/react-devtools-shared/src/devtools/views/DuplicateInstallationDialog.js b/packages/react-devtools-shared/src/devtools/views/DuplicateInstallationDialog.js index 9e7ff156cd3c2..12a32ce4b7f43 100644 --- a/packages/react-devtools-shared/src/devtools/views/DuplicateInstallationDialog.js +++ b/packages/react-devtools-shared/src/devtools/views/DuplicateInstallationDialog.js @@ -9,11 +9,10 @@ import * as React from 'react'; import {Fragment, useContext, useEffect} from 'react'; +import {isInternalFacebookBuild} from 'react-devtools-feature-flags'; import {ModalDialogContext} from './ModalDialog'; -type Props = {|isInternalBuild: boolean|}; - -export default function DuplicateInstallationDialog(props: Props) { +export default function DuplicateInstallationDialog(_: {||}) { const {dispatch} = useContext(ModalDialogContext); useEffect(() => { @@ -22,13 +21,13 @@ export default function DuplicateInstallationDialog(props: Props) { id: 'DuplicateInstallationDialog', type: 'SHOW', title: 'Duplicate Installations of DevTools Detected', - content: , + content: , }); }, []); return null; } -function DialogContent(props: Props) { +function DialogContent(_: {||}) { return (

@@ -36,7 +35,7 @@ function DialogContent(props: Props) { installed and enabled in your browser at the same time, which will cause issues while using the extension.

- {props.isInternalBuild ? ( + {isInternalFacebookBuild ? (

Before proceeding, please ensure that the only enabled version of React Developer Tools is the internal (Chef-installed) version. To