Check fallback fade/image load status on mount
This commit is contained in:
parent
f2db4cf4d0
commit
2dde902027
@ -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);
|
||||
}, []);
|
||||
|
||||
const getBlurClass = () => {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user