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: disconnect previous wallet #2712

Merged
merged 2 commits into from
Oct 31, 2023

Conversation

schmanu
Copy link
Member

@schmanu schmanu commented Oct 31, 2023

What it solves

When switching the wallet the previously connected wallet stays connected.
This can lead to many edge cases for the social signer.

How this PR fixes it

If the user successfully switches the wallet, we disconnect the old wallet label.

How to test it

  1. Login with google
  2. Click switch wallet and connect to Metamask
  3. Disconnect Metamask
  4. you are no longer connected to google automatically

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

@schmanu schmanu changed the base branch from dev to web3authcoresdk October 31, 2023 10:48
@github-actions
Copy link

github-actions bot commented Oct 31, 2023

Branch preview

✅ Deploy successful!

https://fix_disconnect_previous_wallet--walletweb.review-wallet-web.5afe.dev

@katspaugh
Copy link
Member

katspaugh commented Oct 31, 2023

That was actually a feature. If we're throwing it away, you can just remove the Switch wallet button altogether.

Alternatively, disconnect only if it's a social login.

@usame-algan
Copy link
Member

I would also be in favour of limiting this to social login only and adding tracking for the Switch Wallet button to decide later if we should remove it or not.

}

if (newWalletLabel !== oldWalletLabel) {
await onboard.disconnectWallet({ label: oldWalletLabel })
Copy link
Member

@katspaugh katspaugh Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we disconnect if the old wallet is social login? What if the new wallet is social login and the old one is MM? Will it work fine?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes exactly.
Only the Social signer will be disconnected if switched to another wallet.
We could also remove this behavior once we support every chain. But this is currently causing issues QA found.

@schmanu schmanu merged commit 915ef37 into web3authcoresdk Oct 31, 2023
2 of 6 checks passed
@schmanu schmanu deleted the fix-disconnect-previous-wallet branch October 31, 2023 14:55
@github-actions github-actions bot locked and limited conversation to collaborators Oct 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants