-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[bug] Disconnects after switching network #563
Comments
Unfortunately, there is a bug with MetaMask that causes this when using the extension interface MetaMask/metamask-extension#13375 (comment) We try to mitigate this as much as possible when switching networks programmatically with wagmi (e.g. |
Thanks for the response @tmm 🤞🏽 |
hey @tmm 👋 As indicated in this thread and in MetaMask/metamask-extension#13375, despite passing Yet, when testing this on a mature non-wagmi app such as Uniswap, we're able to switch (to, from) any chain in the metamask browser extension without the Uniswap UI involuntarily disconnecting. What is it that the Uniswap UI is doing that wagmi isn't doing now, and could we start doing it? Alternatively, maybe my wagmi is misconfigured and there is something else I should be doing to prevent the metamask browser extension from involuntarily disconnecting when switching chains inside the extension? For reference: new MetaMaskConnector({
chains,
options: {
shimDisconnect: true,
shimChainChangedDisconnect: true,
},
}), |
Looks correct! Want to create a new issue with a minimal reproducible example and I can take a look? |
|
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. |
Is there an existing issue for this?
Package Version
^0.4.6
Current Behavior
I'm using Wagmi with Rainbow Kit for our project. Today I realized that when I change the network I connected,
data
from theuseAccount
hook andactiveChain
from theuseNetwork
start returning null and undefined. The weird thing is that it's not happening every time, looks like there is a race condition and when I keep switching networks, it disconnects me at a point.You can try with the link I created on CodeSandbox.
Expected Behavior
Keep returning data with the switched network. As a result, it disconnects me, I mean I see the rainbow button in the disconnected state.
Steps To Reproduce
Link to Minimal Reproducible Example (CodeSandbox, StackBlitz, etc.)
https://codesandbox.io/s/magical-gwen-8zx2x8?file=/src/App.js:253-263
Anything else?
Screen.Recording.2022-06-07.at.19.41.42.mov
The text was updated successfully, but these errors were encountered: