From 7ca21a4a42eac8514832bec2e0ac62e1c6b83e66 Mon Sep 17 00:00:00 2001 From: JayJay1024 Date: Thu, 19 Oct 2023 13:47:55 +0800 Subject: [PATCH] update check by decimals --- packages/apps/src/components/balance-input.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/apps/src/components/balance-input.tsx b/packages/apps/src/components/balance-input.tsx index 97cbdd473..683bbac1e 100644 --- a/packages/apps/src/components/balance-input.tsx +++ b/packages/apps/src/components/balance-input.tsx @@ -68,7 +68,8 @@ export function BalanceInput({ }, [value, dynamic]); useEffect(() => { - if (!tokenRef.current && token) { + // Fire onChange to update `formatted` + if (tokenRef.current?.decimals !== token?.decimals) { onChange({ value: value?.value || "", formatted: parseUnits(value?.value || "0", token?.decimals || 0) }); } tokenRef.current = token;