From 2dde902027fc1907ed3d6bfc5699addeb37a5bd2 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 16 Jul 2025 17:35:09 -0500 Subject: [PATCH] Check fallback fade/image load status on mount --- src/components/image/ImageWithFallback.tsx | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/components/image/ImageWithFallback.tsx b/src/components/image/ImageWithFallback.tsx index 489cc2c2..9e33ba95 100644 --- a/src/components/image/ImageWithFallback.tsx +++ b/src/components/image/ImageWithFallback.tsx @@ -33,16 +33,12 @@ export default function ImageWithFallback({ const onError = useCallback(() => setDidError(true), []); useEffect(() => { - const timeout = setTimeout(() => { - // If image is still loading after 50ms, force CSS animation - if ( - !ref.current?.complete || - (ref.current?.naturalWidth ?? 0) === 0 - ) { - setFadeFallbackTransition(true); - } - }, 50); - return () => clearTimeout(timeout); + if ( + !ref.current?.complete || + (ref.current?.naturalWidth ?? 0) === 0 + ) { + setFadeFallbackTransition(true); + } }, []); const getBlurClass = () => {