Smooth out fallbacks on initial load

This commit is contained in:
Sam Becker 2025-07-12 10:38:01 -05:00
parent 443aba830f
commit 3b5d8214a2

View File

@ -34,11 +34,11 @@ export default function ImageWithFallback({
useEffect(() => { isLoadingRef.current = isLoading; }, [isLoading]); useEffect(() => { isLoadingRef.current = isLoading; }, [isLoading]);
useEffect(() => { useEffect(() => {
const timeout = setTimeout(() => { const timeout = setTimeout(() => {
// If image is still loading after 200ms, force CSS animation // If image is still loading after 150ms, force CSS animation
if (isLoadingRef.current) { if (isLoadingRef.current) {
setFadeFallbackTransition(true); setFadeFallbackTransition(true);
} }
}, 200); }, 150);
return () => clearTimeout(timeout); return () => clearTimeout(timeout);
}, []); }, []);