Skip to content

Commit

Permalink
fix(suite): token price loading (#14012)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamSchinzel authored Aug 29, 2024
1 parent dc0e7bd commit 9d55477
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions packages/suite/src/components/suite/FiatValue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ import {
useFiatFromCryptoValueParams,
} from 'src/hooks/suite/useFiatFromCryptoValue';
import { HiddenPlaceholderProps } from './HiddenPlaceholder';
import { useLoadingSkeleton } from 'src/hooks/suite';
import { useLoadingSkeleton, useSelector } from 'src/hooks/suite';
import { SkeletonRectangle } from '@trezor/components';
import { selectIsSpecificCoinDefinitionKnown } from '@suite-common/token-definitions';
import { NetworkSymbol } from '@suite-common/wallet-config';
import { TokenAddress } from '@suite-common/wallet-types';

const StyledHiddenPlaceholder = styled((props: HiddenPlaceholderProps) => (
<HiddenPlaceholder {...props} />
Expand Down Expand Up @@ -82,10 +85,19 @@ export const FiatValue = ({

const WrapperComponent = disableHiddenPlaceholder ? SameWidthNums : StyledHiddenPlaceholder;

const isTokenKnown = useSelector(state =>
selectIsSpecificCoinDefinitionKnown(
state,
symbol as NetworkSymbol,
tokenAddress || ('' as TokenAddress),
),
);

if (
(!rate || !value || !currentRate?.lastTickerTimestamp || isLoading) &&
showLoadingSkeleton &&
!currentRate?.error
!currentRate?.error &&
isTokenKnown
) {
return <SkeletonRectangle animate={shouldAnimate} />;
}
Expand Down

0 comments on commit 9d55477

Please sign in to comment.