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

If already connected it shows another prompt for selecting account #3603

Closed
1 task done
mqklin opened this issue Feb 16, 2024 · 6 comments
Closed
1 task done

If already connected it shows another prompt for selecting account #3603

mqklin opened this issue Feb 16, 2024 · 6 comments

Comments

@mqklin
Copy link
Contributor

mqklin commented Feb 16, 2024

Describe the bug

connect shouldn't show prompt for selecting account if already connected. In MetaMask it makes 2 extra popups every time user log in a dApp, this makes UX confusing.

Glitch helped to find this: https://github.com/wevm/wagmi/blob/main/packages/core/src/connectors/injected.ts#L154C38-L154C87

Link to Minimal Reproducible Example

No response

Steps To Reproduce

https://lab.web3modal.com/library/wagmi/

  1. Click "Connect wallet", connect some acc
  2. Click "Disconnect"
  3. Make sure acc is still connected to the site
  4. Click "Connect wallet" again

Please check the video:
https://github.com/wevm/wagmi/assets/9456433/f80a2631-91ea-4be9-ab48-ce4c08b0456e

Wagmi Version

@wagmi/core 2.6.5, wagmi/connectors 4.1.14

Viem Version

2.7.9

TypeScript Version

I don't use TypeScript

Check existing issues

Anything else?

No response

@1997roylee
Copy link
Contributor

1997roylee commented Feb 16, 2024

I believe the issue is triggered by Metamask.

@mqklin
Copy link
Contributor Author

mqklin commented Feb 16, 2024

Maybe, but what would u suggest? In my experience, MetaMask need at least 1 month to fix something. IMO it's a low chance they will prio this task just because of wagmi. On the other hand, wagmi introduced this UX breaking change. So I can't upgrade libs (wagmi/ viem to v2) till this is fixed.

@tmm
Copy link
Member

tmm commented Feb 16, 2024

This is intentional. Since MetaMask (and some other wallets do not support disconnect), Wagmi shims this behavior. When you connect after disconnecting, Wagmi attempts to show the account selector just like when you connect for the first time.

@tmm tmm closed this as not planned Won't fix, can't repro, duplicate, stale Feb 16, 2024
@mqklin
Copy link
Contributor Author

mqklin commented Feb 16, 2024

@tmm Is there a way to make it work like in v1? Why shimDisconnect: false doesn't affect this behaviour?

@tmm
Copy link
Member

tmm commented Feb 16, 2024

Feel free to open a PR that disables this when shimDisconnect is false.

Copy link
Contributor

github-actions bot commented Mar 2, 2024

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 other comments you can create a new discussion.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants