Skip to content

[Bug]: Network changed events fired with a delay #13375

Open
@SpasiboKojima

Description

@SpasiboKojima

Describe the bug

I hope I'm at the right place because it doesn't seem much of a bug, but maybe something can be done about it.
I'm connecting Metamask to my app, and right after user grants access I check the chainId, if it's not the one I expect I do wallet_switchEthereumChain, and if right after that I do login process again where this time it passes chainId check and subscriptions happen, and after going this far MM emits events disconnect or/and accountsChanged. Alternatively, without auto-login after chain switch if you click fast enough on login button again after network switch you'll catch this events.
BUT it doesn't happen if the target chain is mainnet, in my case it's Binance Smart Chain and it's Testnet that I'm testing.
Again, events related to network switch fire much later after it actually happened

Steps to reproduce

  1. Try to login into app with wrong network
  2. Have a wallet_switchEthereumChain request asking you to change network to the right one
  3. Click on login button again within 1.5 seconds or automatically try to connect through web3
  4. Have chainId check passed but still get an event related to changing networks much later

Error messages or log output

No response

Version

10.8.1

Build type

No response

Browser

Chrome, Firefox

Operating system

Linux

Hardware wallet

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions