-
Notifications
You must be signed in to change notification settings - Fork 826
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: using useAccount
address causes hydration error
#453
Comments
It works as it should - there is no account on the server, so there is a mismatch. Why it works on their side? Well, it took some time to find. Look what those cheaters do in |
Actually, this worked before like it used not to give a I tried traveling through commits and it seems something broke at -> fb3fcd6 Fix auto connect (#412) If you checkout to its parent commit -> cc1af9f fix: type issues when multiple contracts deployed (#410) there it seems to work without any hydration issues |
cc1af9f - wagmi config After #412 it changed, wagmi config To fix it we can write a simple wrapper using |
Description :So I have been tinkering in the branch play/useAutoConnect-useAccount and setup few things there to test :
Now if you try auto connect functionality it works since we do not have patch in place i.e we are using When using
Now once you change the value into
We have auto connect broken but now the debug contracts page works nicely Some Solutions :
|
Gj Shiv! I think custom solutions like I think you have already seen this wevm/wagmi#542 . There is no official solution, they propose to use I think the easiest way is to use a wrapper for every broken hook because it's easy to understand and maintain, it doesn't break Something like this
please lmk if I don't consider something and let's see what others think upd. I understood what's wrong with my solution, there are values in |
Ohh yeah this makes sense and yup it will be hard to maintain also we will be needing to do same for other breaking hooks too, lol It didn't come to my mind until you mentioned 🙌
Yup, I completely get this feeling!! and I agree it's not the best solution but since we have been using custom Also, I have been taking a look at other protocols / SDK's docs and they suggest adding custom We can also mention about this in our SE-2 docs, saying we are using custom "useAutoConnect" to handle auto-connect and if you need any third-party integration which requires Saying that it's great to keep an eye on wevm/wagmi#542 because they said that they will internally handle this once NEXT.js 13 is stable enough 🙌 and also let's see what others have to tell But Thanks for the input and digging as always 🙌 |
Is there an existing issue for this?
Current Behavior
It seems that displaying simple
address
fromuseAccount
give "Hydration Error" :Steps To Reproduce
Anything else?
I was just trying to reproduce this normal wagmi-rainbowkit starter kit using
create-wagmi
But it seems that they are using very latest version of next and they have wrapped whole logic in the component which is marked as "use client" checkout -> https://github.com/technophile-04/wagmi-debug/blob/750944c40657d94bf503878108b660d87a7e32d7/src/components/Connected.tsx#L1
I will try to debug it more in SE-2 itself but CCing @carletex @rin-st @sverps if something clicks up
The text was updated successfully, but these errors were encountered: