Remove context usage from ReaderPage
In case many chapters are rendered, even just the HOC wrapper component re-render due to the context change increases the render time. Thus, getting rid of these HOC wrapper re-renders by moving the context usage up to the ReaderViewer decreases the render time.
This commit is contained in:
@@ -23,7 +23,7 @@ const BaseReaderPagedPager = ({
|
||||
return (
|
||||
<BasePager
|
||||
{...props}
|
||||
createPage={(page, pagesIndex, shouldLoad, shouldDisplay) =>
|
||||
createPage={(page, pagesIndex, shouldLoad, shouldDisplay, _setRef, ...baseProps) =>
|
||||
createReaderPage(
|
||||
page,
|
||||
pagesIndex,
|
||||
@@ -35,6 +35,7 @@ const BaseReaderPagedPager = ({
|
||||
shouldDisplay && shouldLoad && currentPageIndex === page.primary.index,
|
||||
currentPageIndex,
|
||||
totalPages,
|
||||
...baseProps,
|
||||
pageLoadStates[page.primary.index].error ? retryFailedPagesKeyPrefix : undefined,
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user