rainbow-me / rainbowkit

The best way to connect a wallet 🌈 🧰
https://rainbowkit.com
MIT License
2.42k stars 643 forks source link

[bug]Cannot reconnect Metamask after disconnecting #2022

Closed theawkwardchild closed 4 months ago

theawkwardchild commented 4 months ago

Is there an existing issue for this?

RainbowKit Version

2.1.2

wagmi Version

2.9.8

Current Behavior

After connecting and then disconnecting using Metamask, you are not able to reconnect with Metamask until the page is refreshed. Additionally, if you first connect using Metamask, then disconnect, then connect using another option such as Walletconnect, and then disconnect, you will be reconnected to your original Metamask wallet. The wagmi.store found in the Local Storage is also not being reset when disconnecting from Metamask.

Expected Behavior

The expected behavior is that after disconnecting from your Metamask wallet, you should be able to reconnect again to Metamask without having to reload the page. It also should not reconnect your Metamask session after disconnecting from another provider.

Steps To Reproduce

  1. Open any of the rainbowkit examples (tested each of the CodeSandbox examples as well as running the project on my own computer)
  2. Connect with Metamask on desktop using the browser extension
  3. Click on your wallet profile and disconnect
  4. Again click the Connect Wallet button and select Metamask
  5. See how it hangs and does not open the Metamask extension to prompt you to connect
  6. Exit the Metamask connection and connect a different wallet using WalletConnect
  7. Disconnect from your current WalletConnect session
  8. See how it instantly reopens your previously disconnected Metamask wallet session
  9. Refreshing the page you will briefly see a quick flash of your previously connected wallet, only then will you be able to reconnect using Metamask

Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)

https://codesandbox.io/p/sandbox/github/rainbow-me/rainbowkit/tree/main/examples/with-vite

Anything else?

Connect using Metamask image
Disconnect image
Trying and failing to reconnect using Metamask image

magiziz commented 4 months ago

@theawkwardchild This is weird. I'm able to connect with metamask while disconnecting and connecting again. Can you try doing this in a different browser or try close and reopen your browser ? Also are you able to reproduce this issue in our example dApp here https://rainbowkit-example.vercel.app ?

image

theawkwardchild commented 4 months ago

Hey @magiziz thanks for checking that out. You might be able to close this as just a problem on my end. I had tried on both chrome and firefox and was seeing the issue, but then a friend had no issues himself.

magiziz commented 4 months ago

@theawkwardchild Mhmm this is weird. Let me know if you still get stuck on this otherwise feel free to re-open this issue 👍