useDApp
useDApp copied to clipboard
changing network must wait for new block to update state
Consider the following simple example where I am reading the user's balance:
const { account, active } = useEthers();
const balance = useEtherBalance(account);
<div>
{`Balance: ${balance ? formatEther(balance).slice(0, 5) : "0.00"} ETH`}
</div>
If the user switches networks in Metamask wallet, almost everything works as expected.
Dev tools output for reference:

The following happens immediately:
- (New Network) connected
- A new multicall address is used.
- 1 call updated (get Eth balacne now using the multicall address).
But NO state is updated... Only when a new block is found does the eth balance state update.
I'm not sure if this is a bug or an implementation detail, but I'd like to see an immediate update of any state based on chain reads as soon as either account or network changes.
Hello,
does the issue persist for you with the latest useDApp version?