From 5ef11e61d06df343007b4b393d24a3c905730ac3 Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 8 Feb 2023 21:35:59 -0500 Subject: [PATCH] Prioritize finding selected chapter when deduping reader chapters Fixes #9054 (cherry picked from commit 23432e44050cd8638f070745edf77be75aeffe21) --- .../java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt index 825f682463..a9d31c21c1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt @@ -177,10 +177,11 @@ class ReaderViewModel( }.run { if (readerPreferences.skipDupe().get()) { groupBy { it.chapterNumber } - .mapValues { (_, chapters) -> - chapters.find { it.id == chapterId || it.scanlator == selectedChapter.scanlator } ?: chapters.first() + .map { (_, chapters) -> + chapters.find { it.id == selectedChapter.id } + ?: chapters.find { it.scanlator == selectedChapter.scanlator } + ?: chapters.first() } - .values } else { this }