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

[Disconnect Wallet] Disconnect wallet seems like a dummy feature and doesn't work the way it's supposed to work. #69

Closed
1 task done
Deveshb15 opened this issue Jan 12, 2022 · 6 comments · Fixed by #119

Comments

@Deveshb15
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Package Version

0.0.17

Current Behavior

The disconnect wallet feature from the useAccount hook doesn't seem to disconnect the wallet completely and just shows that it is disconnected on the client side as I have autoconnect enabled while declaring the Provider in the App.js even after disconnecting the wallet if I reload the app it gets connected to the account that I connected previously.

Expected Behavior

The disconnect feature should remove the app from the metamask connected sites of the user is what I believe and I'm not sure if its possible but what I've seen other packages do is they change the account state to undefined and even after a reload it stays undefined unless and until the user connects wallet again.

Steps To Reproduce

Codesandbox link:- https://codesandbox.io/s/thirsty-butterfly-6i0ct

Anything else?

No response

@tmm
Copy link
Member

tmm commented Jan 12, 2022

It works fine for WalletConnect and WalletLink. MetaMask (and some other injected providers) don't support programmatically disconnecting. Check out this comment for more info.

I also commented on an issue in the MetaMask repo to see if development of this feature can continue.

@tmm tmm closed this as completed Jan 12, 2022
@Deveshb15
Copy link
Author

@tmm Thank you for the reply, hope metamask fixes this soon!

@tmm tmm linked a pull request Jan 29, 2022 that will close this issue
@murathanje
Copy link

Did you solve this issue? I get same issue and I need to solve that. What can I do?

1 similar comment
@murathanje
Copy link

Did you solve this issue? I get same issue and I need to solve that. What can I do?

@refatsherfedinov
Copy link

@murathanje @Deveshb15
just add small timeout for disconnect and it will work

        // Delayed disconnect
        const timer = setTimeout(() => {
            disconnect();
        }, 100);

        return () => clearTimeout(timer);

Copy link
Contributor

github-actions bot commented Jan 5, 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 Jan 5, 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

Successfully merging a pull request may close this issue.

4 participants