Skip to content

Commit

Permalink
Prevent TypeError in Reader chapter update
Browse files Browse the repository at this point in the history
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
  • Loading branch information
schroda committed Apr 30, 2024
1 parent 5a97f11 commit dc9d9df
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/screens/Reader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export function Reader() {
inLibraryAt: 0,
lastReadAt: 0,
chapters: { totalCount: 0 },
trackRecords: { totalCount: 0 },
}) as unknown as TManga,
[mangaId],
);
Expand Down Expand Up @@ -426,7 +427,7 @@ export function Reader() {
});

openNextChapter(ChapterOffset.NEXT);
}, [chapter.pageCount, openNextChapter]);
}, [chapter.pageCount, openNextChapter, chapter, manga]);

const loadPrevChapter = useCallback(() => {
openNextChapter(ChapterOffset.PREV);
Expand Down

0 comments on commit dc9d9df

Please sign in to comment.