From c5b3daa35bb6003af59e3fbd4f38337a2abecec9 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Fri, 1 Jul 2022 10:38:42 -0230 Subject: [PATCH] Ensure native asset icon does not display incorrectly when switching networks and balance is loading (#15116) --- ui/components/app/asset-list/asset-list.js | 4 +++- ui/components/app/wallet-overview/eth-overview.js | 1 + ui/components/app/wallet-overview/wallet-overview.js | 6 ++++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ui/components/app/asset-list/asset-list.js b/ui/components/app/asset-list/asset-list.js index da0209e8d..08f8c6169 100644 --- a/ui/components/app/asset-list/asset-list.js +++ b/ui/components/app/asset-list/asset-list.js @@ -37,6 +37,8 @@ const AssetList = ({ onClickAsset }) => { const nativeCurrency = useSelector(getNativeCurrency); const showFiat = useSelector(getShouldShowFiat); const trackEvent = useContext(MetaMetricsContext); + const balance = useSelector(getSelectedAccountCachedBalance); + const balanceIsLoading = !balance; const { currency: primaryCurrency, @@ -76,7 +78,7 @@ const AssetList = ({ onClickAsset }) => { } tokenSymbol={primaryCurrencyProperties.suffix} secondary={showFiat ? secondaryCurrencyDisplay : undefined} - tokenImage={primaryTokenImage} + tokenImage={balanceIsLoading ? null : primaryTokenImage} identiconBorder /> { return ( { +const WalletOverview = ({ balance, buttons, className, icon, loading }) => { + console.log('balance1', balance); return (
- {icon} + {loading ? null : icon} {balance}
{buttons}
@@ -19,6 +20,7 @@ WalletOverview.propTypes = { buttons: PropTypes.element.isRequired, className: PropTypes.string, icon: PropTypes.element.isRequired, + loading: PropTypes.boolean, }; WalletOverview.defaultProps = {