[bug] Disconnect not persisting and reconnecting on page load
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Package Version
0.0.17
Current Behavior
Using a Next.js app, Im calling the disconnect
function from the useAccount
hook. It does disconnect but then after refreshing the page it reconnects again and the account info re-populates
Expected Behavior
I would expect to be disconnected from ym wallet so that I may be able to reconnect again with a different wallet or simply use the site in its disconnected state
Steps To Reproduce
- Connect via InjectedConnector -> useAccount becomes populated with data and useConnect returns
connected:true
. - Press disconnect button which calls the
disconnect
function. -> useAccount returns empty data as expected andconnected: false
. - Refresh the page
- usAccount becomes populated with data again and
connected:true
Anything else?
No response
Edit: It seems as though if I remove autoConnect
prop on the provider then it does indeed keep me disconnected however that then means on every refresh I need to reconnect. Ideally I would like connect automatically until I explicitly call disconnect
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Must disconnect then reconnect WiFi to load pages.
It always says I am connected but acts as if it isn't, then as I described I go through the procedure and the...
Read more >socket.io not reconnecting after a disconnect
Said another way, properly configured socket.io code should not have to include the code in your answer. Make a connection once and let...
Read more >Client socket.disconnect does not stop reconnection attempts
When you call connect() again the reconnection is not working anymore. The main problems are that in the method "Manager.prototype.reconnect" a variable "this....
Read more >Most common website connection issues and how to ...
1. Authentication Failed ... When it comes to this issue, the first thing that should come to your mind is cache! This usually...
Read more >After disconnecting client, reconnecting is not working.
So, when I disconnect and go back to the main menu, when the player presses the button "Play", I delete everything and load...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah ok yeah that makes sense! Happy to stick what the most default behaviour is in that case
@sammdec MM (and other injected providers) don’t support programmatically disconnecting.
I agree it’s confusing to reconnect on page reload, but technically it’s the most accurate since the account is still connected to the browser. (wagmi does handle disconnect events coming from connector directly. For example, disconnecting in MM UI.)
That said, you could manage connection status separately in the browser, but you would need to listen and handle different connection events (i.e. disconnecting or switching account directly through MM extensions).