From d7d297590eef7a32359fef0963e2afaf9a647486 Mon Sep 17 00:00:00 2001 From: Tarik Gul <47201679+TarikGul@users.noreply.github.com> Date: Wed, 15 May 2024 05:09:33 -0700 Subject: [PATCH] Fix polkadex assets balances page (#10576) * Fix polkadex assets balances page * remove console.log --- packages/page-assets/src/Balances/index.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/page-assets/src/Balances/index.tsx b/packages/page-assets/src/Balances/index.tsx index e260bf7026..fe60bd4315 100644 --- a/packages/page-assets/src/Balances/index.tsx +++ b/packages/page-assets/src/Balances/index.tsx @@ -23,6 +23,7 @@ function Balances ({ className, infos = [] }: Props): React.ReactElement const [infoIndex, setInfoIndex] = useState(0); const [info, setInfo] = useState(null); const balances = useBalances(info?.id); + const maxNumLength = Number.MAX_SAFE_INTEGER.toString().length; const headerRef = useRef<([React.ReactNode?, string?, number?] | false)[]>([ [t('accounts'), 'start'], @@ -42,9 +43,9 @@ function Balances ({ className, infos = [] }: Props): React.ReactElement const assetOptions = useMemo( () => completeInfos.map(({ id, metadata }) => ({ text: `${metadata.name.toUtf8()} (${formatNumber(id)})`, - value: id.toNumber() + value: id.toString().length < maxNumLength ? id.toNumber() : id.toString() })), - [completeInfos] + [completeInfos, maxNumLength] ); const siFormat = useMemo( @@ -67,7 +68,7 @@ function Balances ({ className, infos = [] }: Props): React.ReactElement useEffect((): void => { setInfo(() => infoIndex >= 0 - ? completeInfos.find(({ id }) => id.toNumber() === infoIndex) ?? null + ? completeInfos.find(({ id }) => id.toString() === infoIndex.toString()) ?? null : null ); }, [completeInfos, infoIndex]);