From 0edec685f9d96eb0cdf94d6e176b730fc743fb65 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Tue, 13 Feb 2024 01:53:49 +0100 Subject: [PATCH] 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 7caea4e5262ecbd42a06a37de57623a2cafa9b61 --- src/screens/Reader.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screens/Reader.tsx b/src/screens/Reader.tsx index c7f1d76b..94213b70 100644 --- a/src/screens/Reader.tsx +++ b/src/screens/Reader.tsx @@ -224,7 +224,7 @@ export function Reader() { }; 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 shouldDownloadAhead =