governance-ui icon indicating copy to clipboard operation
governance-ui copied to clipboard

Wallet disconnects when reloading the page

Open RaymondDashWu opened this issue 2 years ago • 1 comments

This happens when a manual reload is done (devnet toggle switch), pressing F5, etc. Another possible edge case could happen when switching to different wallets.

RaymondDashWu avatar Apr 25 '22 21:04 RaymondDashWu

I'll try to continue working on this, but incase anyone wants to give it a go here's what is wanted out of functionality:

  • Reconnect wallet automatically if wallet is never disconnected manually (as long as it's the same browser session) - On refresh or change to devnet/mainnet - Try not to store wallet info into local storage/session storage/cookies
  • Must manually reconnect and ask for re-login to wallet IF it is a different browser session
  • Must not ask a user to login to their wallet on site load UNTIL they manually click the connect wallet button, especially for new users

BONUS: Figure out a way to change the wallet connected on the site as you switch wallets within your Phantom wallet

Here's a CodeSandbox that can give insight into all of this: https://codesandbox.io/s/github/phantom-labs/sandbox?file=/src/App.tsx

masayafunakoshi1 avatar Apr 27 '22 22:04 masayafunakoshi1