diff --git a/ui/components/app/dropdowns/network-dropdown.js b/ui/components/app/dropdowns/network-dropdown.js index 09e94c498..c40ccc79d 100644 --- a/ui/components/app/dropdowns/network-dropdown.js +++ b/ui/components/app/dropdowns/network-dropdown.js @@ -286,22 +286,20 @@ class NetworkDropdown extends Component { } renderNonInfuraDefaultNetwork(networkConfigurations, network) { - const { - provider: { type: providerType }, - setActiveNetwork, - upsertNetworkConfiguration, - } = this.props; + const { provider, setActiveNetwork, upsertNetworkConfiguration } = + this.props; - const isCurrentRpcTarget = providerType === NETWORK_TYPES.RPC; + const { chainId, ticker, blockExplorerUrl } = BUILT_IN_NETWORKS[network]; + const networkName = NETWORK_TO_NAME_MAP[network]; + const rpcUrl = CHAIN_ID_TO_RPC_URL_MAP[chainId]; + + const isCurrentRpcTarget = + provider.type === NETWORK_TYPES.RPC && rpcUrl === provider.rpcUrl; return ( { - const { chainId, ticker, blockExplorerUrl } = - BUILT_IN_NETWORKS[network]; - const networkName = NETWORK_TO_NAME_MAP[network]; - const networkConfiguration = pickBy( networkConfigurations, (config) => config.rpcUrl === CHAIN_ID_TO_RPC_URL_MAP[chainId], @@ -310,7 +308,6 @@ class NetworkDropdown extends Component { let configurationId = null; // eslint-disable-next-line no-extra-boolean-cast, no-implicit-coercion if (!!networkConfiguration) { - const rpcUrl = CHAIN_ID_TO_RPC_URL_MAP[chainId]; configurationId = await upsertNetworkConfiguration( { rpcUrl, @@ -346,7 +343,7 @@ class NetworkDropdown extends Component { data-testid={`${network}-network-item`} style={{ color: - providerType === network + provider.type === network ? 'var(--color-text-default)' : 'var(--color-text-alternative)', }} diff --git a/ui/pages/settings/networks-tab/networks-tab.js b/ui/pages/settings/networks-tab/networks-tab.js index bbc0443cd..7ba0e29af 100644 --- a/ui/pages/settings/networks-tab/networks-tab.js +++ b/ui/pages/settings/networks-tab/networks-tab.js @@ -30,11 +30,13 @@ import NetworksTabContent from './networks-tab-content'; import NetworksForm from './networks-form'; import NetworksFormSubheader from './networks-tab-subheader'; -const defaultNetworks = defaultNetworksData.map((network) => ({ - ...network, - viewOnly: true, - isATestNetwork: TEST_CHAINS.includes(network.chainId), -})); +const defaultNetworks = defaultNetworksData + .map((network) => ({ + ...network, + viewOnly: true, + isATestNetwork: TEST_CHAINS.includes(network.chainId), + })) + .filter((network) => network.chainId !== CHAIN_IDS.LINEA_TESTNET); const NetworksTab = ({ addNewNetwork }) => { const t = useI18nContext(); @@ -55,8 +57,8 @@ const NetworksTab = ({ addNewNetwork }) => { getNetworksTabSelectedNetworkConfigurationId, ); - const networkConfigurationsList = Object.entries(networkConfigurations) - .map(([networkConfigurationId, networkConfiguration]) => { + const networkConfigurationsList = Object.entries(networkConfigurations).map( + ([networkConfigurationId, networkConfiguration]) => { return { label: networkConfiguration.nickname, iconColor: 'var(--color-icon-alternative)', @@ -68,8 +70,8 @@ const NetworksTab = ({ addNewNetwork }) => { isATestNetwork: TEST_CHAINS.includes(networkConfiguration.chainId), networkConfigurationId, }; - }) - .filter((network) => network.chainId !== CHAIN_IDS.LINEA_TESTNET); + }, + ); let networksToRender = [...defaultNetworks, ...networkConfigurationsList]; if (!SHOULD_SHOW_LINEA_TESTNET_NETWORK) {