Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: toBignumber conversion error with high balance #12010

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 { 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
Loading