Skip to content

Commit

Permalink
remove unecessary imagesSrc states on token logo component
Browse files Browse the repository at this point in the history
  • Loading branch information
yvesfracari committed May 29, 2024
1 parent e9129d1 commit 7a1cf7a
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions apps/cow-amm-deployer/src/components/TokenLogo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const cowTokenListLogoUrl = (address?: string, chainId?: ChainId) => {
return cowTokenList.find(
(token) =>
token.chainId === chainId &&
token.address.toLowerCase() === address?.toLowerCase(),
token.address.toLowerCase() === address?.toLowerCase()
)?.logoURI;
};

Expand All @@ -50,25 +50,18 @@ export const TokenLogo = ({
className,
quality,
}: ImageFallbackProps) => {
const [imagesSrc, setImagesSrc] = useState<string[]>([
const imagesSrc = [
cowprotocolTokenLogoUrl(tokenAddress, chainId),
cowprotocolTokenLogoUrl(tokenAddress, 1),
cowTokenListLogoUrl(tokenAddress, chainId),
cowTokenListLogoUrl(tokenAddress, 1),
trustTokenLogoUrl(tokenAddress, chainId),
trustTokenLogoUrl(tokenAddress, 1),
FALLBACK_SRC,
] as string[]);
] as string[];
const [index, setIndex] = useState(0);

useEffect(() => {
setImagesSrc([
cowprotocolTokenLogoUrl(tokenAddress, chainId),
cowprotocolTokenLogoUrl(tokenAddress, 1),
trustTokenLogoUrl(tokenAddress, chainId),
trustTokenLogoUrl(tokenAddress, 1),
FALLBACK_SRC,
] as string[]);
setIndex(0);
}, [tokenAddress, chainId]);

Expand Down

0 comments on commit 7a1cf7a

Please sign in to comment.