Skip to content

Commit f4b25d7

Browse files
authored
Ensure native asset icon does not display incorrectly when switching networks and balance is loading (#15116)
1 parent fa6eca3 commit f4b25d7

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

ui/components/app/asset-list/asset-list.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ const AssetList = ({ onClickAsset }) => {
3737
const nativeCurrency = useSelector(getNativeCurrency);
3838
const showFiat = useSelector(getShouldShowFiat);
3939
const trackEvent = useContext(MetaMetricsContext);
40+
const balance = useSelector(getSelectedAccountCachedBalance);
41+
const balanceIsLoading = !balance;
4042

4143
const {
4244
currency: primaryCurrency,
@@ -76,7 +78,7 @@ const AssetList = ({ onClickAsset }) => {
7678
}
7779
tokenSymbol={primaryCurrencyProperties.suffix}
7880
secondary={showFiat ? secondaryCurrencyDisplay : undefined}
79-
tokenImage={primaryTokenImage}
81+
tokenImage={balanceIsLoading ? null : primaryTokenImage}
8082
identiconBorder
8183
/>
8284
<TokenList

ui/components/app/wallet-overview/eth-overview.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const EthOverview = ({ className }) => {
5252

5353
return (
5454
<WalletOverview
55+
loading={!balance}
5556
balance={
5657
<Tooltip
5758
position="top"

ui/components/app/wallet-overview/wallet-overview.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import classnames from 'classnames';
44

5-
const WalletOverview = ({ balance, buttons, className, icon }) => {
5+
const WalletOverview = ({ balance, buttons, className, icon, loading }) => {
6+
console.log('balance1', balance);
67
return (
78
<div className={classnames('wallet-overview', className)}>
89
<div className="wallet-overview__balance">
9-
{icon}
10+
{loading ? null : icon}
1011
{balance}
1112
</div>
1213
<div className="wallet-overview__buttons">{buttons}</div>
@@ -19,6 +20,7 @@ WalletOverview.propTypes = {
1920
buttons: PropTypes.element.isRequired,
2021
className: PropTypes.string,
2122
icon: PropTypes.element.isRequired,
23+
loading: PropTypes.boolean,
2224
};
2325

2426
WalletOverview.defaultProps = {

0 commit comments

Comments
 (0)