Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] WalletConnect connector creates multiple instances and gets unsynced from the app #2232

Open
1 task done
iceanddust opened this issue Oct 24, 2024 · 1 comment
Open
1 task done

Comments

@iceanddust
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

RainbowKit Version

2.2.0

wagmi Version

2.12.25

Current Behavior

After connecting to the WalletConnect connector and reloading the app, a second instance of the connected connector is created, which prevents the wallet from notifying the app about changes, and eventually throwing a Error: No matching key. history: <number> error.

I double checked and this is not an issue if I directly connect through Wagmi's WalletConnect connector. I also tried connecting through WC with a Safe Wallet and a Metamask wallet and could reproduce the problem in both cases.

Expected Behavior

The WalletConnect connection should keep working between reloads of the app, or worst case scenario, it should automatically disconnect on reloads to prevent the bad UX for the user using the app

Steps To Reproduce

  • Open the Minimal Reproducible Example provided
  • Update the projectId for a valid WC project ID
  • Open the preview in a new tab (top-right corner). It's important to open the app in a full tab to reproduce the issue
  • Click the connect button and connect through WalletConnect. In the console you can see that it's connected to a single WC instance
  • Reload the tab
  • Open the console and you will now see that the app is connected to 2 instances of WalletConnect
  • Switch the network through the ConnectButton, confirm in your wallet and you will notice that the app will not be notified about the successful action, then you will be able to see the No matching key. history error in the console

This error seems to affect all messages sent from the wallet to the app, I've also experienced it with transaction statuses on a larger app, where the wallet never notifies the app about confirmed, successful or transactions with errors

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

https://stackblitz.com/edit/new-wagmi-bfc6lr?file=src%2Fwagmi.ts%3AL7

Anything else?

No response

@generatorpoint
Copy link

@DanielSinclair can you have a look at this issue? It's preventing Rainbow users from connecting with Safe and WalletConnect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@generatorpoint @iceanddust and others