Prevent unnecessary "page load state" updates

Only update state in case it has changed
This commit is contained in:
schroda
2024-12-27 18:23:16 +01:00
parent 3ca379c0f1
commit d6ff85fdd3

View File

@@ -186,9 +186,13 @@ const BaseReaderViewer = forwardRef(
img.src = url;
}
if (pageLoadStates[index]) {
return;
}
setPageLoadStates((statePageLoadStates) => statePageLoadStates.toSpliced(index, 1, { loaded: true }));
},
[actualPages, readingMode],
[actualPages, readingMode, pageLoadStates],
);
const onError = useCallback((pageIndex: number) => {