Skip to content

Custom connector, reconnectOnMount and nextjs #4678

Closed Answered by tuler
tuler asked this question in Q&A
Discussion options

You must be logged in to vote

Problem solved.

My connector implementation of getProvider was returning a variable that was only lazily initialized in the connect call.
When wagmi hydrates the initial state from the cookie it reads the recentConnectorId cookie, searches for that providers, and call getProvider. If it returns undefined, which was my case, it skips it, and don't continue the reconnection procedure.

I changed the implementation of getProvider to check a storage item and also hydrate my provider from it. Then isAuthorized is called, followed by connect with isReconnecting = true

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Surya-Git-hub
Comment options

Answer selected by tuler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants