Handle faulty "lastPageRead" values
There seems to be a bug on the server which sets the "lastPageRead" of a chapter to -1 which should not happen
This commit is contained in:
@@ -62,7 +62,7 @@ import {
|
|||||||
getReaderChapterViewerCurrentPageIndex,
|
getReaderChapterViewerCurrentPageIndex,
|
||||||
getReaderChapterViewResumeMode,
|
getReaderChapterViewResumeMode,
|
||||||
} from '@/modules/reader/utils/Reader.utils.ts';
|
} from '@/modules/reader/utils/Reader.utils.ts';
|
||||||
import { noOp } from '@/lib/HelperFunctions.ts';
|
import { coerceIn, noOp } from '@/lib/HelperFunctions.ts';
|
||||||
import { useNavBarContext } from '@/modules/navigation-bar/contexts/NavbarContext.tsx';
|
import { useNavBarContext } from '@/modules/navigation-bar/contexts/NavbarContext.tsx';
|
||||||
import { NavbarContextType } from '@/modules/navigation-bar/NavigationBar.types.ts';
|
import { NavbarContextType } from '@/modules/navigation-bar/NavigationBar.types.ts';
|
||||||
|
|
||||||
@@ -341,7 +341,7 @@ const BaseReaderViewer = forwardRef(
|
|||||||
nextChapterId={nextChapter?.id}
|
nextChapterId={nextChapter?.id}
|
||||||
isPreviousChapterVisible={isPreviousChapterVisible}
|
isPreviousChapterVisible={isPreviousChapterVisible}
|
||||||
isNextChapterVisible={isNextChapterVisible}
|
isNextChapterVisible={isNextChapterVisible}
|
||||||
lastPageRead={chapter.lastPageRead}
|
lastPageRead={coerceIn(chapter.lastPageRead, 0, chapter.pageCount - 1)}
|
||||||
currentPageIndex={getReaderChapterViewerCurrentPageIndex(
|
currentPageIndex={getReaderChapterViewerCurrentPageIndex(
|
||||||
currentPageIndex,
|
currentPageIndex,
|
||||||
chapter,
|
chapter,
|
||||||
|
|||||||
Reference in New Issue
Block a user