Skip to content

Commit

Permalink
Fix duplicate import, better focus and item autofocus
Browse files Browse the repository at this point in the history
  • Loading branch information
darkwing committed Jul 25, 2023
1 parent fb5bbcc commit 0ba6023
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,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';
Expand Down Expand Up @@ -81,6 +80,8 @@ export const NetworkListMenu = ({ onClose }) => {

const lineaMainnetReleased = useSelector(isLineaMainnetNetworkReleased);

const showSearch = nonTestNetworks.length > 3;

useEffect(() => {
if (currentlyOnTestNetwork) {
dispatch(setShowTestNetworks(currentlyOnTestNetwork));
Expand Down Expand Up @@ -126,7 +127,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) {
Expand Down Expand Up @@ -191,7 +192,7 @@ export const NetworkListMenu = ({ onClose }) => {
{t('networkMenuHeading')}
</ModalHeader>
<>
{nonTestNetworks.length > 3 ? (
{showSearch ? (
<Box
paddingLeft={4}
paddingRight={4}
Expand Down

0 comments on commit 0ba6023

Please sign in to comment.