From 63fef3ab7c74c9dc3204370638e34ad26a18e596 Mon Sep 17 00:00:00 2001 From: Koitharu Date: Tue, 21 Jun 2022 11:00:18 +0300 Subject: [PATCH] Fix empty chapters placeholder #176 --- .../org/koitharu/kotatsu/details/ui/DetailsViewModel.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/koitharu/kotatsu/details/ui/DetailsViewModel.kt b/app/src/main/java/org/koitharu/kotatsu/details/ui/DetailsViewModel.kt index 8fb901792..757c70f61 100644 --- a/app/src/main/java/org/koitharu/kotatsu/details/ui/DetailsViewModel.kt +++ b/app/src/main/java/org/koitharu/kotatsu/details/ui/DetailsViewModel.kt @@ -92,9 +92,12 @@ class DetailsViewModel( branches.indexOf(selected) }.asLiveDataDistinct(viewModelScope.coroutineContext + Dispatchers.Default) - val isChaptersEmpty: LiveData = delegate.manga.map { m -> - m != null && m.chapters.isNullOrEmpty() - }.asLiveDataDistinct(viewModelScope.coroutineContext + Dispatchers.Default, false) + val isChaptersEmpty: LiveData = combine( + delegate.manga, + isLoading.asFlow(), + ) { m, loading -> + m != null && m.chapters.isNullOrEmpty() && !loading + }.asLiveDataDistinct(viewModelScope.coroutineContext, false) val chapters = combine( combine(