Correctly select next chapter id for download ahead (#596)

Chapters are being fetched sorted by descending source order, thus, the next chapters index is less than the current one

Regression introduced with 7caea4e526
This commit is contained in:
schroda
2024-02-13 01:53:49 +01:00
committed by GitHub
parent d244ba6538
commit 0edec685f9

View File

@@ -224,7 +224,7 @@ export function Reader() {
}; };
const currentChapter = getChapterFromCache(chapter.id); const currentChapter = getChapterFromCache(chapter.id);
const nextChapterId = mangaChapters?.[Number(chapterIndex) + 1]?.id; const nextChapterId = mangaChapters?.[(mangaChapters?.length ?? 0) - Number(chapterIndex) - 1]?.id;
const nextChapter = nextChapterId ? getChapterFromCache(nextChapterId) : null; const nextChapter = nextChapterId ? getChapterFromCache(nextChapterId) : null;
const shouldDownloadAhead = const shouldDownloadAhead =