web3-react icon indicating copy to clipboard operation
web3-react copied to clipboard

WalletConnectV2 unable to re-connect

Open lcamargof opened this issue 2 years ago • 6 comments

Unable to reconnect using WalletConnectV2, for V1 I removed the localStorage variable before connecting but V2 introduce a lot of new variables and removing them doesn't work.

This can be reproduced with the hosted example:

  • Connect with WalletConnectV2
  • Disconnect
  • Try to connect again -> nothing happens

lcamargof avatar Jun 29 '23 18:06 lcamargof

Hi @lcamargof, I tested with our react-app example here and our Web3Modal demo and cannot reproduce the issue you are seeing with the steps provided.

Could you please share additional steps (ideally a complete reproducible example) so that I can reproduce the issue on my end? 🙏

chris13524 avatar Jun 29 '23 18:06 chris13524

Hi @chris13524 I'll take a look at the code for the official repo example, but I reproduced the issue with the web3-react demo, you can reproduce it with this code

Edit: As a workaround, after connector.deactivate() I needed to add a 1000ms timeout to call activate() and the wallet modal shows up.

lcamargof avatar Jun 29 '23 18:06 lcamargof

I am able to reproduce it as well in my dApp.

addmorebass avatar Jun 29 '23 20:06 addmorebass

I found that this is caused by using IndexDB. As a fix, I use clearing WALLET_CONNECT_V2_INDEXED_DB in the browser, but it requires a page reload to take effect. Looks glitchy. Has anyone found a proper way to avoid this?

andreich-tut avatar Jun 18 '24 14:06 andreich-tut

Edit: As a workaround, after connector.deactivate() I needed to add a 1000ms timeout to call activate() and the wallet modal shows up.

It doesn't look like stable solution

andreich-tut avatar Jun 18 '24 14:06 andreich-tut

Hi @lcamargof, I tested with our react-app example here and our Web3Modal demo and cannot reproduce the issue you are seeing with the steps provided.

Could you please share additional steps (ideally a complete reproducible example) so that I can reproduce the issue on my end? 🙏

I'm guessing that you couldn't reproduce the bug because your application redirects the user to another page. Everything seems to be working fine in this case. But my application can display a 401/403 response error and keep the user on the login page.

andreich-tut avatar Jun 18 '24 14:06 andreich-tut