Describe the bug
A clear and concise description of what the bug is.
const { data, isLoading } = useBalance({ chainId: MyChainId, denom: MyDenom })
console.log(isLoading)
In case of a newly created wallet that has no balance, isLoading is always true which makes it look like the balance is loading forever where instead there's actually no balance.
...
To Reproduce
Steps to reproduce the behavior:
- Create an app that connects a wallet and displays a balance using
useBalance
- Create a new wallet that has no coins
- Connect the wallet
Expected behavior
isLoading becomes false to indicate the balance has been loaded. data can continue to be undefined to indicate there is no balance.
Temporary workaround
const { isLoading, data } = useBalances({ chainId: MyChainId, denom: MyDenom })
const balance = isLoading
? undefined
: (data && data.find((coin) => coin.denom === MyDenom)) || { denom: MyDenom, amount: '0' }
return {
data: balance,
isLoading
}
Describe the bug
A clear and concise description of what the bug is.
In case of a newly created wallet that has no balance,
isLoadingis always true which makes it look like the balance is loading forever where instead there's actually no balance....
To Reproduce
Steps to reproduce the behavior:
useBalanceExpected behavior
Temporary workaround