Properly update "StandardReaderProgressBar" slots on "progress bar position" change

"createProgressBarSlot" was never called in case the function reference changed but none of the passed arguments
This commit is contained in:
schroda
2024-12-27 17:16:35 +01:00
parent 052625a013
commit 3ca379c0f1
3 changed files with 15 additions and 17 deletions

View File

@@ -73,6 +73,7 @@ export const ReaderProgressBarSlotWrapper = memo(
totalPages,
),
[
createProgressBarSlot,
page,
pagesIndex,
primaryPageLoadState,

View File

@@ -20,28 +20,27 @@ export const ReaderProgressBarSlotDesktop = memo(
pageUrl,
primaryPageLoadState,
secondaryPageLoadState,
isHorizontal,
isVertical,
progressBarPosition,
isCurrentPage,
isFirstPage,
isLastPage,
isLeadingPage,
isDragging,
}: Pick<IReaderSettings, 'progressBarPosition'> &
Pick<ReturnType<typeof getProgressBarPositionInfo>, 'isHorizontal' | 'isVertical'> & {
pageName: string;
pageUrl: string;
primaryPageLoadState: boolean;
secondaryPageLoadState?: boolean;
isCurrentPage: boolean;
isFirstPage: boolean;
isLastPage: boolean;
isLeadingPage: boolean;
isDragging: boolean;
}) => {
}: Pick<IReaderSettings, 'progressBarPosition'> & {
pageName: string;
pageUrl: string;
primaryPageLoadState: boolean;
secondaryPageLoadState?: boolean;
isCurrentPage: boolean;
isFirstPage: boolean;
isLastPage: boolean;
isLeadingPage: boolean;
isDragging: boolean;
}) => {
const theme = useTheme();
const { isVertical, isHorizontal } = getProgressBarPositionInfo(progressBarPosition);
return (
<ReaderProgressBarSlot
key={pageUrl}

View File

@@ -71,8 +71,6 @@ const BaseStandardReaderProgressBar = ({
pageUrl={page.primary.url}
primaryPageLoadState={primaryPageLoadState}
secondaryPageLoadState={secondaryPageLoadState}
isHorizontal={isHorizontal}
isVertical={isVertical}
progressBarPosition={progressBarPosition}
isCurrentPage={isCurrentPage}
isFirstPage={pagesIndex === 0}
@@ -81,7 +79,7 @@ const BaseStandardReaderProgressBar = ({
isDragging={isDragging}
/>
),
[isHorizontal, isVertical, isDragging, progressBarPosition],
[progressBarPosition, isDragging],
)}
slotProps={{
container: {