diff --git a/apps/renderer/src/components/ui/media/preview-media.tsx b/apps/renderer/src/components/ui/media/preview-media.tsx index c84f6ac02..2a03fd858 100644 --- a/apps/renderer/src/components/ui/media/preview-media.tsx +++ b/apps/renderer/src/components/ui/media/preview-media.tsx @@ -296,54 +296,36 @@ const FallbackableImage: FC< return (
{!isAllError && ( - // FIXME: optimize this if image load, the placeholder background will flash -
- {blurhash ? ( -
+
height ? "w-full" : "h-full")}> + setIsLoading(false)} + onError={handleError} + height={props.height} + width={props.width} + {...props} + className={cn( + "transition-opacity duration-700", + isLoading ? "opacity-0" : "opacity-100", + props.className, + )} + style={props.style} + /> +
+ {blurhash ? ( -
- ) : ( - - )} + ) : ( + + )} +
)} - {!isAllError && ( - setIsLoading(false)} - onError={handleError} - height={props.height} - width={props.width} - {...props} - className={cn( - "transition-opacity duration-700", - isLoading ? "opacity-0" : "opacity-100", - props.className, - )} - style={ - Number.isNaN(height) || Number.isNaN(width) || height === 0 || width === 0 - ? props.style - : { - maxHeight: `min(100%, ${height}px)`, - maxWidth: `min(100%, ${width}px)`, - ...props.style, - } - } - /> - )} {isAllError && (