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

On refresh, always disconnected #7

Open
AndrewSB opened this issue May 18, 2022 · 1 comment
Open

On refresh, always disconnected #7

AndrewSB opened this issue May 18, 2022 · 1 comment

Comments

@AndrewSB
Copy link

hey, along the lines of reown-com/appkit#388, how do i display the cachedProvider's connection state on a reload?

@AndrewSB
Copy link
Author

worked around by doing

  const { account, connect, disconnect, web3Modal } = useWallet()

  useEffect(() => {
    if (!account && web3Modal?.cachedProvider) {
      connect(connectOptions)
    }
  }, [account, web3Modal, connect])

in my ConnectButton, but i'm surprised i had to do this & it wasn't automatically handled by useWallet. is that expected?

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

No branches or pull requests

1 participant