wevm / wagmi

React Hooks for Ethereum

Home Page:https://wagmi.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Initial state & useChainId bug

matthewlilley opened this issue · comments

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

  1. Run app
  2. Change chain with one of the buttons
  3. 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

Anything else?

No response

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.