Prevent TypeError and incorrect state updates for "pageLoadStates"

Page load state updates of an already closed chapter caused TypeErrors or incorrect state updates.
This commit is contained in:
schroda
2024-12-30 20:51:29 +01:00
parent 55dc9471d9
commit 7c98bab43b
9 changed files with 59 additions and 21 deletions

View File

@@ -524,3 +524,8 @@ export const getScrollToXForReadingDirection = (
return getOptionForDirection(-element.scrollWidth, 0, themeDirectionForReadingDirection);
};
export const isPageOfOutdatedPageLoadStates = (
url: string,
pageLoadState: ReaderStatePages['pageLoadStates'][number] | undefined,
): boolean => pageLoadState === undefined || pageLoadState.url !== url;