Skip to content

Commit

Permalink
fix: toBignumber conversion error with high balance
Browse files Browse the repository at this point in the history
  • Loading branch information
siibars committed Oct 24, 2024
1 parent ea176e9 commit fc7623c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/components/UI/Stake/hooks/useBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
weiToFiatNumber,
} from '../../../../util/number';
import usePooledStakes from './usePooledStakes';
import { BN } from 'ethereumjs-util';

const useBalance = () => {
const accountsByChainId = useSelector(selectAccountsByChainId);
Expand Down Expand Up @@ -50,8 +51,8 @@ const useBalance = () => {
);

const { pooledStakesData } = usePooledStakes();
const assets = pooledStakesData.assets ?? 0;

const assets = pooledStakesData.assets ? new BN(pooledStakesData.assets) : new BN(0);

Check failure on line 54 in app/components/UI/Stake/hooks/useBalance.ts

View workflow job for this annotation

GitHub Actions / scripts (lint)

The 'assets' conditional could make the dependencies of useMemo Hook (at line 58) change on every render. To fix this, wrap the initialization of 'assets' in its own useMemo() Hook

Check failure on line 54 in app/components/UI/Stake/hooks/useBalance.ts

View workflow job for this annotation

GitHub Actions / scripts (lint)

The 'assets' conditional could make the dependencies of useMemo Hook (at line 63) change on every render. To fix this, wrap the initialization of 'assets' in its own useMemo() Hook

Check warning on line 55 in app/components/UI/Stake/hooks/useBalance.ts

View workflow job for this annotation

GitHub Actions / scripts (lint)

Trailing spaces not allowed
const formattedStakedBalanceETH = useMemo(
() => `${renderFromWei(assets)} ETH`,
[assets],
Expand Down

0 comments on commit fc7623c

Please sign in to comment.