From 023518971e24ecdeb635aa3f4f9b03e6d8e7d348 Mon Sep 17 00:00:00 2001 From: Nicholas Gambino Date: Mon, 18 Nov 2024 13:54:04 -0800 Subject: [PATCH] fix: Issue 28509 - when navigating to send/swap from a token from a chain that is not on the selected network, ensure correct balance is prepopulated in fromToken amount --- ui/pages/asset/components/asset-page.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ui/pages/asset/components/asset-page.tsx b/ui/pages/asset/components/asset-page.tsx index 69b9fabf92d0..c7b7b767147d 100644 --- a/ui/pages/asset/components/asset-page.tsx +++ b/ui/pages/asset/components/asset-page.tsx @@ -155,6 +155,14 @@ const AssetPage = ({ tokenMarketDetails.allTimeHigh > 0 || tokenMarketDetails.allTimeLow > 0); + // this is needed in order to assign the correct balances to TokenButtons before sending/swapping + // without this, the balances we be populated as zero until the user refreshes the screen: https://github.com/MetaMask/metamask-extension/issues/28509 + asset.balance = { + value: '', // decimal value not needed + display: String(balance), + fiat: String(tokenFiatAmount), + }; + return (