From 999c5954f335eec91b38adb6ad4a423503c775c6 Mon Sep 17 00:00:00 2001 From: schroda <50052685+schroda@users.noreply.github.com> Date: Wed, 27 Mar 2024 21:11:41 +0100 Subject: [PATCH] Use correct chapter list for guard condition (#676) In case of the "mark_prev_read" as read action, the passed chapter list was empty and thus the guard to exit early was incorrectly triggered --- src/components/chapter/ChapterActionMenuItems.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/chapter/ChapterActionMenuItems.tsx b/src/components/chapter/ChapterActionMenuItems.tsx index c48c5b93..ef50418a 100644 --- a/src/components/chapter/ChapterActionMenuItems.tsx +++ b/src/components/chapter/ChapterActionMenuItems.tsx @@ -109,11 +109,6 @@ export const ChapterActionMenuItems = ({ } } - if (!chaptersWithMeta.length) { - onClose(); - return; - } - const getChapters = (): (ChapterDownloadInfo & ChapterBookmarkInfo & ChapterReadInfo)[] => { // select mode if (!chapter) { @@ -134,6 +129,13 @@ export const ChapterActionMenuItems = ({ return allChapters.slice(index + 1); }; + const chapters = getChapters(); + + if (!chapters.length) { + onClose(); + return; + } + Chapters.performAction(actualAction, chapter ? [chapter.id] : ChaptersWithMeta.getIds(chaptersWithMeta), { chapters: getChapters(), wasManuallyMarkedAsRead: true,