Prevent blinking on reader page switch on firefox

on firefox images are decoded async which causes a "flicker/blinking" when they're getting visible for the first time
this is an issue especially in the reader because pages that should not be shown are rendered but
not displayed, which then causes this issue once they get displayed
This commit is contained in:
schroda
2024-11-13 14:27:00 +01:00
parent f9938edb75
commit 87ee1330d4
2 changed files with 94 additions and 11 deletions

View File

@@ -28,11 +28,20 @@ interface IProps {
onImageLoad?: () => void;
shouldDecode?: boolean;
useFetchApi?: boolean;
}
export const SpinnerImage = forwardRef((props: IProps, imgRef: ForwardedRef<HTMLImageElement | null>) => {
const { useFetchApi, src, alt, onImageLoad, spinnerStyle: { small, ...spinnerStyle } = {}, imgStyle } = props;
const {
shouldDecode,
useFetchApi,
src,
alt,
onImageLoad,
spinnerStyle: { small, ...spinnerStyle } = {},
imgStyle,
} = props;
const { t } = useTranslation();
@@ -57,7 +66,7 @@ export const SpinnerImage = forwardRef((props: IProps, imgRef: ForwardedRef<HTML
return () => {};
}
const imageRequest = requestManager.requestImage(src, Priority.HIGH, useFetchApi);
const imageRequest = requestManager.requestImage(src, { priority: Priority.HIGH, shouldDecode, useFetchApi });
let cacheTimeout: NodeJS.Timeout;
const fetchImage = async () => {