Fix pages thumbnails loading

This commit is contained in:
Koitharu
2023-10-13 14:26:52 +03:00
parent 5b53f8c27d
commit 97524d66f2
28 changed files with 258 additions and 174 deletions

View File

@@ -7,7 +7,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.last
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
import org.koitharu.kotatsu.core.model.findById
@@ -52,7 +52,7 @@ class PagesThumbnailsViewModel @Inject constructor(
init {
loadingJob = launchLoadingJob(Dispatchers.Default) {
chaptersLoader.init(checkNotNull(mangaDetails.last()))
chaptersLoader.init(checkNotNull(mangaDetails.first { x -> x?.isLoaded == true }))
chaptersLoader.loadSingleChapter(initialChapterId)
updateList()
}