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:
schroda
2024-04-30 20:16:23 +02:00
parent 5a97f11703
commit dc9d9dfa3f

View File

@@ -85,6 +85,7 @@ export function Reader() {
inLibraryAt: 0,
lastReadAt: 0,
chapters: { totalCount: 0 },
trackRecords: { totalCount: 0 },
}) as unknown as TManga,
[mangaId],
);
@@ -426,7 +427,7 @@ export function Reader() {
});
openNextChapter(ChapterOffset.NEXT);
}, [chapter.pageCount, openNextChapter]);
}, [chapter.pageCount, openNextChapter, chapter, manga]);
const loadPrevChapter = useCallback(() => {
openNextChapter(ChapterOffset.PREV);