1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

Ensure native asset icon does not display incorrectly when switching networks and balance is loading (#15116)

This commit is contained in:
Dan J Miller 2022-07-01 10:38:42 -02:30 committed by GitHub
parent fa6eca39e9
commit f4b25d7ea5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 3 deletions

View File

@ -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
/>
<TokenList

View File

@ -52,6 +52,7 @@ const EthOverview = ({ className }) => {
return (
<WalletOverview
loading={!balance}
balance={
<Tooltip
position="top"

View File

@ -2,11 +2,12 @@ import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
const WalletOverview = ({ balance, buttons, className, icon }) => {
const WalletOverview = ({ balance, buttons, className, icon, loading }) => {
console.log('balance1', balance);
return (
<div className={classnames('wallet-overview', className)}>
<div className="wallet-overview__balance">
{icon}
{loading ? null : icon}
{balance}
</div>
<div className="wallet-overview__buttons">{buttons}</div>
@ -19,6 +20,7 @@ WalletOverview.propTypes = {
buttons: PropTypes.element.isRequired,
className: PropTypes.string,
icon: PropTypes.element.isRequired,
loading: PropTypes.boolean,
};
WalletOverview.defaultProps = {