Skip to content

Commit

Permalink
fix balance refresh bug
Browse files Browse the repository at this point in the history
  • Loading branch information
mrnaveira committed Sep 27, 2023
1 parent 52315e4 commit 4a2415d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/site/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,13 @@ const Index = () => {

const refreshAccountBalances = async () => {
const balanceData = await getBalances();
let balances = balanceData.balances.map(b => { return ({ name: b.token_symbol || "Tari", address: b.resource_address, balance: b.balance }); });
setAccountBalances(balances);
if (balanceData) {
let balances = balanceData.balances.map(b => { return ({ name: b.token_symbol || "Tari", address: b.resource_address, balance: b.balance }); });
setAccountBalances(balances);

// we keep polling for balances to keep them updated
setTimeout(async () => { await refreshAccountBalances() }, 2000);
// we keep polling for balances to keep them updated
setTimeout(async () => { await refreshAccountBalances() }, 2000);
}
}

useEffect(() => {
Expand Down

0 comments on commit 4a2415d

Please sign in to comment.