wevm / wagmi

React Hooks for Ethereum

Home Page:https://wagmi.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Injected connector does not re-connect when browser closed and reopen

yulafezmesi opened this issue · comments

hey, when i connected with injected connector and prefresh page, it's perfectly reconnect the injected wallet again.

however, when i close all tabs and browser, and try to open same page again, the metamask password popup does not open. in this case metamask popup locked (expected) but the metamask connection needs to be triggered.

as you can see here, when i close browser and open again, it shows the address first and suddenly disappeared without triggering popup again.

Screen.Recording.2024-04-03.at.11.17.41.mov

Link to Minimal Reproducible Example

https://new-wagmi-mfdots.vercel.app

Steps To Reproduce

for the better replication, deployed the static website: https://new-wagmi-mfdots.vercel.app

you can find the codes here: https://stackblitz.com/edit/new-wagmi-mfdots

Wagmi Version

2.5.18

Viem Version

2.9.8

TypeScript Version

5.2.2

Check existing issues

Anything else?

No response

commented

I would say this is expected. When the MetaMask extension is locked, the wallet is technically now disconnected – there is no way we can extract accounts/connection state from the wallet. I wouldn't say attempting to reconnect upon page-load with a prompt is the best UX (this is an anti-pattern for Web APIs such as permission, popups, etc) as it would surprise end-users, so I think the best approach for now is to leave it as-is.

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.