-
-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Labels
bugSomething isn't workingSomething isn't working
Description
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
isLoadingbecomesfalseto indicate the balance has been loaded.datacan continue to beundefinedto 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
}mplummeridge
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working