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
This commit is contained in:
schroda
2024-03-27 21:11:41 +01:00
committed by GitHub
parent 64ac49fa41
commit 999c5954f3

View File

@@ -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,