From e294bd8bdbdea57aba6e99ed499d7d97ed7fb445 Mon Sep 17 00:00:00 2001 From: Jobobby04 Date: Sun, 18 Dec 2022 12:49:59 -0500 Subject: [PATCH] Fix page previews not going to the correct page --- .../java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt | 4 ++++ 1 file changed, 4 insertions(+) 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 dbb2ee06a..fe57e9342 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 @@ -86,6 +86,7 @@ import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.distinctUntilChanged +import kotlinx.coroutines.flow.drop import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.firstOrNull @@ -252,6 +253,9 @@ class ReaderViewModel( state.map { it.viewerChapters?.currChapter } .distinctUntilChanged() .filterNotNull() + // SY --> + .drop(1) // allow the loader to set the first page and chapter id + // SY <- .onEach { currentChapter -> if (!currentChapter.chapter.read) { currentChapter.requestedPage = currentChapter.chapter.last_page_read