rainbow-me / rainbowkit

The best way to connect a wallet 🌈 🧰

Home Page:https://rainbowkit.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[bug] Website auto-connecting to MM extension wallet even after disconnecting

futantan opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

RainbowKit Version

2.1.1

wagmi Version

2.9.8

Current Behavior

When disconnect, the website will connect to previous wallet

Expected Behavior

Disconnect from all wallets

Steps To Reproduce

CleanShot.2024-05-31.at.20.08.31.mp4
  1. Visit https://www.rainbowkit.com/docs/introduction
  2. Connect MetaMask extension wallet
  3. Disconnect MetaMask extension wallet and connect OKX wallet with WalletConnect
  4. Click Disconnect button

It will disconnect the OKX wallet, and connect to MetaMask wallet immediately

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

No response

Anything else?

No response

commented

Wagmi supports multiple wallet connections at once by default.

It will also reconnect on mount to multiple wallets which you've connected before. You can set reconnectOnMount to false in <WagmiProvider>. Check out the docs for reference here https://wagmi.sh/react/api/WagmiProvider#reconnectonmount

hi @magiziz thanks for your suggestion, but this won't fix the issue, and this is not the expected behavior.
because once we add reconnectOnMount to false, when we connect to Metamask and refresh the page, the connect will lost.

We found this issue when upgrading from 1.x to 2.x

@futantan I see! Wagmi has a feature called "shim disconnects" that will remember which connector has been disconnected, and avoid reconnecting that connector on the next mount. There is an outstanding issue that seems to exist inside of Wagmi that we are currently investigating with the Wagmi team. We hope this will be resolved soon. wevm/wagmi#3606

thank you @DanielSinclair how about we reopen this issue to track how it goes?

commented

@futantan Are you still able to reproduce this with the latest Wagmi version 2.11.1 ?