Skip to content

Commit

Permalink
updated loading state
Browse files Browse the repository at this point in the history
  • Loading branch information
MonikaCat committed Oct 4, 2023
1 parent dff3cd6 commit 1f82552
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions packages/ui/src/screens/account_details/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const formatBalance = (data: Data): BalanceType => {
const rewardsAmount = formatToken(rewards, primaryTokenUnit);

const commission = getDenom(
R.pathOr<NonNullable<NonNullable<typeof data['commission']>['coins']>>(
R.pathOr<NonNullable<NonNullable<(typeof data)['commission']>['coins']>>(
[],
['commission', 'coins'],
data
Expand Down Expand Up @@ -170,7 +170,7 @@ const formatOtherTokens = (data: Data) => {
const availableRawAmount = getDenom(available, x);
const availableAmount = formatToken(availableRawAmount.amount, x);
const rewardsRawAmount = rewards.reduce((a, b) => {
const coins = R.pathOr<NonNullable<typeof b['coins']>>([], ['coins'], b);
const coins = R.pathOr<NonNullable<(typeof b)['coins']>>([], ['coins'], b);
const denom = getDenom(coins, x);
return Big(a).plus(denom.amount).toPrecision();
}, '0');
Expand Down Expand Up @@ -248,11 +248,11 @@ export const useAccountDetails = () => {

useEffect(() => {
const formattedRawData: {
commission?: typeof commission['commission'];
accountBalances?: typeof available['accountBalances'];
delegationBalance?: typeof delegation['delegationBalance'];
unbondingBalance?: typeof unbonding['unbondingBalance'];
delegationRewards?: typeof rewards['delegationRewards'];
commission?: (typeof commission)['commission'];
accountBalances?: (typeof available)['accountBalances'];
delegationBalance?: (typeof delegation)['delegationBalance'];
unbondingBalance?: (typeof unbonding)['unbondingBalance'];
delegationRewards?: (typeof rewards)['delegationRewards'];
} = {};
formattedRawData.commission = R.pathOr({ coins: [] }, ['commission'], commission);
formattedRawData.accountBalances = R.pathOr({ coins: [] }, ['accountBalances'], available);
Expand All @@ -270,6 +270,7 @@ export const useAccountDetails = () => {
useEffect(() => {
handleSetState((prevState) => ({
...prevState,
loading: false,
overview: {
address: address ?? '',
withdrawalAddress: withdrawalAddress.withdrawalAddress?.address ?? '',
Expand Down

0 comments on commit 1f82552

Please sign in to comment.