From 1498a99f5e6b1a02564093b965d6c622c4e7838e Mon Sep 17 00:00:00 2001 From: David Walsh Date: Fri, 21 Jul 2023 12:51:19 -0500 Subject: [PATCH] Fix duplicate import, better focus and item autofocus --- .../multichain/network-list-menu/network-list-menu.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ui/components/multichain/network-list-menu/network-list-menu.js b/ui/components/multichain/network-list-menu/network-list-menu.js index 800d3116e3e3..57159a000366 100644 --- a/ui/components/multichain/network-list-menu/network-list-menu.js +++ b/ui/components/multichain/network-list-menu/network-list-menu.js @@ -37,7 +37,6 @@ import { Box, Text, TextFieldSearch, - Text, } from '../../component-library'; import { ADD_POPULAR_CUSTOM_NETWORK } from '../../../helpers/constants/routes'; import { getEnvironmentType } from '../../../../app/scripts/lib/util'; @@ -79,6 +78,8 @@ export const NetworkListMenu = ({ onClose }) => { const lineaMainnetReleased = useSelector(isLineaMainnetNetworkReleased); + const showSearch = nonTestNetworks.length > 3; + useEffect(() => { if (currentlyOnTestNetwork) { dispatch(setShowTestNetworks(currentlyOnTestNetwork)); @@ -123,7 +124,7 @@ export const NetworkListMenu = ({ onClose }) => { iconSrc={network?.rpcPrefs?.imageUrl} key={`${network.id || network.chainId}-${index}`} selected={isCurrentNetwork} - focus={isCurrentNetwork && !isSearching} + focus={isCurrentNetwork && !showSearch} onClick={() => { dispatch(toggleNetworkMenu()); if (network.providerType) { @@ -188,7 +189,7 @@ export const NetworkListMenu = ({ onClose }) => { {t('networkMenuHeading')} <> - {nonTestNetworks.length > 3 ? ( + {showSearch ? (