-
Notifications
You must be signed in to change notification settings - Fork 47.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show warning in UI when duplicate installations of DevTools extension…
… are detected
- Loading branch information
Juan Tejada
committed
Oct 14, 2021
1 parent
545d4c2
commit 2e0f0a4
Showing
6 changed files
with
119 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
packages/react-devtools-shared/src/devtools/views/DuplicateInstallationDialog.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
*/ | ||
|
||
import * as React from 'react'; | ||
import {Fragment, useContext, useEffect} from 'react'; | ||
import {ModalDialogContext} from './ModalDialog'; | ||
|
||
export default function DuplicateInstallationDialog(props: {| | ||
isInternalBuild: boolean, | ||
|}) { | ||
const {dispatch} = useContext(ModalDialogContext); | ||
|
||
useEffect(() => { | ||
dispatch({ | ||
canBeDismissed: false, | ||
id: 'DuplicateInstallationDialog', | ||
type: 'SHOW', | ||
title: 'Duplicate Installations of DevTools Detected', | ||
content: <DialogContent />, | ||
}); | ||
}, []); | ||
return null; | ||
} | ||
|
||
function DialogContent(props: {|isInternalBuild: boolean|}) { | ||
return ( | ||
<Fragment> | ||
<p> | ||
We detected that there are multiple versions of React Developer Tools | ||
installed and enabled in your browser at the same time, which will cause | ||
issues while using the extension. | ||
</p> | ||
{props.isInternalBuild ? ( | ||
<p> | ||
Before proceeding, please ensure that the only enabled version of | ||
React Developer Tools is the internal (Chef-installed) version. To | ||
manage your extensions, visit the <code>about://extensions</code> page | ||
in your browser. | ||
</p> | ||
) : ( | ||
<p> | ||
Please ensure that you have installed and enabled only a single | ||
version of React Developer Tools before proceeding. To manage your | ||
extensions, visit the <code>about://extensions</code> page in your | ||
browser. | ||
</p> | ||
)} | ||
</Fragment> | ||
); | ||
} |