Improve memoization of page rendering

This commit is contained in:
schroda
2024-12-22 00:42:33 +01:00
parent 58c402dd0e
commit 34ad331a71
8 changed files with 178 additions and 135 deletions

View File

@@ -69,8 +69,10 @@ const BaseReaderDoublePagedPager = ({
<Fragment key={`${primary.url}_${secondary?.url}`}>
{createReaderPage(
page,
() => onLoad?.(pagesIndex),
() => onError?.(primary.index),
pagesIndex,
true,
onLoad,
onError,
shouldLoad,
shouldDisplay && isPrimaryPage,
currentPage.primary.index,
@@ -82,8 +84,10 @@ const BaseReaderDoublePagedPager = ({
{hasSecondaryPage &&
createReaderPage(
{ ...page, primary: { ...page.secondary! } },
() => onLoad?.(pagesIndex, false),
() => onError?.(secondary.index),
pagesIndex,
false,
onLoad,
onError,
shouldLoad,
shouldDisplay && isSecondaryPage,
currentSecondaryPageIndex,