You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I checked there isn't already an issue for the bug I encountered.
Describe the bug
When connecting with WalletConnect, the connection reliably persists when you refresh the page. However, if you connect with MetaMask or another wallet via the EIP-1193 auto-injected connector, you get disconnected on page refresh if you have previously disconnected via disconnectAsync from useDisconnect.
It seems the ssr cookies like wagmi.io.metamask.disconnected: true are set on disconnect:
And they are not removed or set to wagmi.io.metamask.disconnected: false when you reconnect via connectAsync from useConnect. If you manually delete these cookies after reconnecting, you will no longer be logged out on refresh.
It seems like it may be best for wagmi to handle deleting these cookies or setting them to false on connect.
I removed the following ssr configuration from my config, and that fixed the issue:
This issue has been locked since it has been closed for more than 14 days.
If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Wagmi version. If you have any questions or comments you can create a new discussion thread.
Check existing issues
Describe the bug
When connecting with WalletConnect, the connection reliably persists when you refresh the page. However, if you connect with MetaMask or another wallet via the EIP-1193 auto-injected connector, you get disconnected on page refresh if you have previously disconnected via
disconnectAsync
fromuseDisconnect
.It seems the ssr cookies like
wagmi.io.metamask.disconnected: true
are set on disconnect:And they are not removed or set to
wagmi.io.metamask.disconnected: false
when you reconnect viaconnectAsync
fromuseConnect
. If you manually delete these cookies after reconnecting, you will no longer be logged out on refresh.It seems like it may be best for wagmi to handle deleting these cookies or setting them to false on connect.
I removed the following ssr configuration from my config, and that fixed the issue:
Link to Minimal Reproducible Example
No response
Steps To Reproduce
No response
What Wagmi package(s) are you using?
wagmi
Wagmi Package(s) Version(s)
2.10.9
Viem Version
2.17.3
TypeScript Version
5.1.3
Anything else?
Relevant part of connector config:
Using React 18.3.1, Next.js 13.4.19, Turborepo, Bun
The text was updated successfully, but these errors were encountered: