From afeb0f9acaefb632d061aa7b812a9a51c60a9413 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Sat, 4 Jan 2025 15:55:48 +0100 Subject: [PATCH] Correctly check if chapter exists The wrong chapter list was used. "chapters" is the filtered list of chapters, which e.g. doesn't contain duplicated chapters. This caused the "chapter source order" to potentially be higher than the total chapters of the manga. The end result of this was that the fetched state of the pages wasn't properly detected causing errors due to rendering the reader before it was in the correct state --- src/modules/reader/screens/Reader.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/reader/screens/Reader.tsx b/src/modules/reader/screens/Reader.tsx index 76f1fae9..93e749d7 100644 --- a/src/modules/reader/screens/Reader.tsx +++ b/src/modules/reader/screens/Reader.tsx @@ -83,7 +83,7 @@ const BaseReader = ({ setSettings, initialChapter, currentChapter, - chapters, + mangaChapters, setReaderStateChapters, firstPageUrl, totalPages, @@ -105,7 +105,7 @@ const BaseReader = ({ 'shouldSkipDupChapters' | 'backgroundColor' | 'shouldShowReadingModePreview' | 'shouldShowTapZoneLayoutPreview' > & Pick & - Pick & + Pick & Pick< ReaderStatePages, | 'totalPages' @@ -164,7 +164,7 @@ const BaseReader = ({ !chaptersResponse.loading && !chaptersResponse.error && chapterSourceOrder >= 0 && - chapterSourceOrder <= chapters.length; + chapterSourceOrder <= mangaChapters.length; const isLoading = currentChapter === undefined || @@ -532,7 +532,7 @@ export const Reader = withPropsFrom( 'setSettings', 'initialChapter', 'currentChapter', - 'chapters', + 'mangaChapters', 'setReaderStateChapters', 'firstPageUrl', 'totalPages',