Add prioritization to image requests (#671)

In the reader the preloaded page requests were triggered before the actual page got rendered and thus, the image request of the rendered page had to wait for all the preloaded images to finish
This commit is contained in:
schroda
2024-03-24 19:08:36 +01:00
committed by GitHub
parent 34aeac9c33
commit 06b2bca340
4 changed files with 125 additions and 16 deletions

View File

@@ -16,6 +16,7 @@ import RefreshIcon from '@mui/icons-material/Refresh';
import { useTranslation } from 'react-i18next';
import { requestManager } from '@/lib/requests/RequestManager.ts';
import { defaultPromiseErrorHandler } from '@/util/defaultPromiseErrorHandler.ts';
import { Priority } from '@/lib/Queue.ts';
interface IProps {
src: string;
@@ -48,7 +49,7 @@ export const SpinnerImage = forwardRef((props: IProps, imgRef: ForwardedRef<HTML
useEffect(() => {
let tmpImageSourceUrl: string;
const imageRequest = requestManager.requestImage(src);
const imageRequest = requestManager.requestImage(src, Priority.HIGH);
let cacheTimeout: NodeJS.Timeout;
const fetchImage = async () => {