1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 11:22:43 +02:00

fix issue preventing switching to localhost (#16707)

This commit is contained in:
Brad Decker 2022-11-29 11:01:23 -05:00 committed by GitHub
parent 119219b5d2
commit 6c6b4aca1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@ import {
NETWORK_TO_NAME_MAP,
CHAIN_ID_TO_RPC_URL_MAP,
CURRENCY_SYMBOLS,
NETWORK_TYPES,
} from '../../../../../shared/constants/network';
import {
isPrefixedFormattedHexString,
@ -107,7 +108,10 @@ async function switchEthereumChainHandler(
type: MESSAGE_TYPE.SWITCH_ETHEREUM_CHAIN,
requestData,
});
if (chainId in CHAIN_ID_TO_TYPE_MAP) {
if (
chainId in CHAIN_ID_TO_TYPE_MAP &&
approvedRequestData.type !== NETWORK_TYPES.LOCALHOST
) {
setProviderType(approvedRequestData.type);
} else {
await updateRpcTarget(approvedRequestData);