I am calling this in my NextJS React app:
provider.send('wallet_addEthereumChain', [networkMaps[networkName]])
Which results in this:
Uncaught (in promise) Error: underlying network changed (event="changed", network={"name":"matic","chainId":137,"ensAddress":null}, detectedNetwork={"name":"maticmum","chainId":80001,"ensAddress":null,"_defaultProvider":null}, code=NETWORK_ERROR, version=providers/5.6.8)
Though when I check metamask, the network was changed. Any ideas why this error pops up?
Also when I wrap that call in a try/catch, the catch does not catch the above Error. Any ideas why?
