From dc9d9dfa3f2343880943d1e7f7bcb70915c2dd03 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Tue, 30 Apr 2024 20:16:23 +0200 Subject: [PATCH] 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 --- src/screens/Reader.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/screens/Reader.tsx b/src/screens/Reader.tsx index 77f9b481..abe40b09 100644 --- a/src/screens/Reader.tsx +++ b/src/screens/Reader.tsx @@ -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);