mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 18:00:18 +01:00
Fixes to the Linea Goerli implementation (#18290)
* Ensure that NonInfuraDefaultNetworks are only selected in the dropdown if they are the currently selected network * Ensure Linea Goerli network appears in network settings tab if added manually
This commit is contained in:
parent
8aead51f30
commit
73173e685d
@ -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 (
|
||||
<DropdownMenuItem
|
||||
key={network}
|
||||
closeMenu={this.props.hideNetworkDropdown}
|
||||
onClick={async () => {
|
||||
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)',
|
||||
}}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user