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

fix: shim disconnect #1879

Closed
wants to merge 2 commits into from
Closed

fix: shim disconnect #1879

wants to merge 2 commits into from

Conversation

DanielSinclair
Copy link
Collaborator

@DanielSinclair DanielSinclair commented Mar 21, 2024

Changes

  • added shimDisconnect flag during connector preparation to prevent automatic reconnects of disconnected connectors

Known issue

  • Wagmi currently iterates through EIP-6963 connectors and attempts to reconnect, seemingly ignoring wagmi.WALLET_ID.disconnected flags in localstorage. On reconnect upon hydrate, Wagmi seems to move to the next EIP-6963 connector and fire connect. After a series of connects and reconnects, there will be multiple different disconnect flags in localstorage for various wallets (even though we connected with the same wallet). This behavior results in shimDisconnect functionality not working as expected
Screenshot 2024-03-21 at 12 31 59 AM Screenshot 2024-03-21 at 12 23 31 AM

https://github.com/wevm/wagmi/blob/97237bb05c30860b9b12c094e82a38ce59d9bedf/packages/core/src/hydrate.ts#L33
https://github.com/wevm/wagmi/blob/c403563be5dd3ab36d8582e69071ce87294468c2/packages/core/src/actions/reconnect.ts#L20

Copy link

vercel bot commented Mar 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
rainbowkit-example ✅ Ready (Inspect) Visit Preview Mar 21, 2024 5:46am
rainbowkit-site ✅ Ready (Inspect) Visit Preview Mar 21, 2024 5:46am

@magiziz
Copy link
Contributor

magiziz commented Mar 26, 2024

Linked issue

@DanielSinclair
Copy link
Collaborator Author

I believe this was fixed in a recent version of Wagmi

@DanielSinclair DanielSinclair deleted the @daniel/shim-disconnect branch April 26, 2024 07:12
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

Successfully merging this pull request may close these issues.

2 participants