Skip to content

Commit

Permalink
fix: fix circular component reference issue
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov committed Nov 7, 2022
1 parent 9288b58 commit e3f3209
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions packages/widget/src/components/TokenAvatar/TokenAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@ export const TokenAvatarFallback: React.FC<{
}> = ({ token, sx }) => {
const { chain } = useChain(token.chainId);
const { token: chainToken } = useToken(token.chainId, token.address);
return <TokenAvatar token={chainToken ?? token} chain={chain} sx={sx} />;
return <TokenAvatarBase token={chainToken ?? token} chain={chain} sx={sx} />;
};

export const TokenAvatar: React.FC<{
export const TokenAvatarBase: React.FC<{
token: Token;
chain?: Chain;
sx?: SxProps<Theme>;
}> = ({ token, chain, sx }) => {
if (!chain || !token.logoURI) {
return <TokenAvatarFallback token={token} sx={sx} />;
}
return (
<Badge
overlap="circular"
Expand All @@ -40,3 +37,14 @@ export const TokenAvatar: React.FC<{
</Badge>
);
};

export const TokenAvatar: React.FC<{
token: Token;
chain?: Chain;
sx?: SxProps<Theme>;
}> = ({ token, chain, sx }) => {
if (!chain || !token.logoURI) {
return <TokenAvatarFallback token={token} sx={sx} />;
}
return <TokenAvatarBase token={token} chain={chain} sx={sx} />;
};

0 comments on commit e3f3209

Please sign in to comment.