-
Notifications
You must be signed in to change notification settings - Fork 758
Description
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 theNo 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