Prevent TypeError in Reader chapter update
In case the manga wasn't loaded immediately, trying to access the trackRecords totalCount caused a TypeError because the initial manga object did not specify it
This commit is contained in:
@@ -85,6 +85,7 @@ export function Reader() {
|
|||||||
inLibraryAt: 0,
|
inLibraryAt: 0,
|
||||||
lastReadAt: 0,
|
lastReadAt: 0,
|
||||||
chapters: { totalCount: 0 },
|
chapters: { totalCount: 0 },
|
||||||
|
trackRecords: { totalCount: 0 },
|
||||||
}) as unknown as TManga,
|
}) as unknown as TManga,
|
||||||
[mangaId],
|
[mangaId],
|
||||||
);
|
);
|
||||||
@@ -426,7 +427,7 @@ export function Reader() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
openNextChapter(ChapterOffset.NEXT);
|
openNextChapter(ChapterOffset.NEXT);
|
||||||
}, [chapter.pageCount, openNextChapter]);
|
}, [chapter.pageCount, openNextChapter, chapter, manga]);
|
||||||
|
|
||||||
const loadPrevChapter = useCallback(() => {
|
const loadPrevChapter = useCallback(() => {
|
||||||
openNextChapter(ChapterOffset.PREV);
|
openNextChapter(ChapterOffset.PREV);
|
||||||
|
|||||||
Reference in New Issue
Block a user