Smooth out fallbacks on initial load
This commit is contained in:
parent
443aba830f
commit
3b5d8214a2
@ -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);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user