fix: display already-loaded imgs with no transition (#6990)

This commit is contained in:
Zach Pomerantz 2023-07-24 16:21:05 -07:00 committed by GitHub
parent db0cb41b61
commit 4537a4dc94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -76,7 +76,11 @@ export default function AssetLogo({
}: AssetLogoProps) {
const [src, nextSrc] = useTokenLogoSource(address, chainId, isNative, backupImg)
const L2Icon = getChainInfo(chainId)?.circleLogoUrl
const [imgLoaded, setImgLoaded] = useState(false)
const [imgLoaded, setImgLoaded] = useState(() => {
const img = document.createElement('img')
img.src = src ?? ''
return src ? img.complete : false
})
return (
<LogoContainer style={style}>