Skip to content
Discussion options

You must be logged in to vote

🔍 Why the Account Doesn’t Update
useAccount() only subscribes to connection events, not account change events, when a user switches accounts inside MetaMask or any injected wallet.
So the UI doesn’t refresh because there’s no listener tracking the new address after the first connection.
In Wagmi v1, account switching must be observed manually using watchAccount().

🛠 Working Fix (Subscribe to Account Changes)
`import { useAccount, watchAccount } from 'wagmi'
import { useState, useEffect } from 'react'

export function useSyncedAccount() {
const { address } = useAccount()
const [current, setCurrent] = useState(address)

useEffect(() => {
const unwatch = watchAccount((acc) => {
setCurrent(acc?…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by furyydev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants