rainbow-me / rainbowkit

The best way to connect a wallet 🌈 🧰

Home Page:https://rainbowkit.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

useChainId returns default chainId even if the current chain is not default.

berkaycirak opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

RainbowKit Version

2.0.1

wagmi Version

2.5.7

Current Behavior

I am using useChainId, and my config is

export const config = getDefaultConfig({
  appName: 'Heroes NFT',
  projectId: projectId,
  chains: [avalanche, herotestnet],
  ssr: true,
});

on the client, when I refresh the page on the herotestnet chain, it returns me two chainIds ( one for avalanche and the other is herotestnet)

const chainId = useChainId()
console.log(chainId) // I see two different value when I refresh the page on the herotestnet

Expected Behavior

I expected to get only one chainId even if the current chain is different from default chain

commented

@berkaycirak Can you use chain id from useAccount hook ?

@berkaycirak This looks to be a Wagmi issue directly. Can you also open an issue on their repo?

Got it, I see it here: wevm/wagmi#3799

Please add additional details to that Issue about: your browser, the wallet you're using, if you have multiple wallets installed and active in your browser, and your project configuration.

The state of these hooks are at a lower level than RainbowKit, so we'll need to investigate further over there.