Initial state & useChainId bug
matthewlilley opened this issue · comments
Matthew Lilley commented
Describe the bug
I expect that useChainId returns the same chain as is in the initial state. It does not.
Link to Minimal Reproducible Example
https://github.com/matthewlilley/wagmi-use-chain-id-bug
Steps To Reproduce
- Run app
- Change chain with one of the buttons
- Refresh page
You'll see that initial state which comes from the cookie has the expected chain id, but the useChainId hook returns the id of the top chain in the list of chains.
Wagmi Version
latest
Viem Version
latest
TypeScript Version
latest
Check existing issues
- I checked there isn't already an issue for the bug I encountered.
Anything else?
No response
github-actions commented
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.