Fix entries not disappearing from list on swipe to dismiss

This commit is contained in:
William Brawner 2022-11-17 21:30:27 -07:00
parent ecd3d36528
commit 22f461dabc
2 changed files with 4 additions and 4 deletions

View file

@ -27,10 +27,11 @@ abstract class EntryListViewModel(
private val _errorMessage = MutableStateFlow<String?>(null) private val _errorMessage = MutableStateFlow<String?>(null)
val errorMessage = _errorMessage.asStateFlow() val errorMessage = _errorMessage.asStateFlow()
protected open val entryStatus: EntryStatus? = null protected open val entryStatus: EntryStatus? = null
private val pagingSource: EntryAndFeedPagingSource private lateinit var pagingSource: EntryAndFeedPagingSource
get() = EntryAndFeedPagingSource(entryRepository, entryStatus)
val entries = Pager(PagingConfig(pageSize = 15)) { val entries = Pager(PagingConfig(pageSize = 15)) {
pagingSource EntryAndFeedPagingSource(entryRepository, entryStatus).also {
pagingSource = it
}
}.flow.cachedIn(viewModelScope) }.flow.cachedIn(viewModelScope)
fun dismissError() { fun dismissError() {

View file

@ -30,7 +30,6 @@ class EntryAndFeedPagingSource(
} else { } else {
null null
} }
Timber.tag("Nanoflux").d("Loading data at page $nextPageNumber")
val loadFunction = when (entryStatus) { val loadFunction = when (entryStatus) {
EntryStatus.UNREAD -> entryRepository::loadUnread EntryStatus.UNREAD -> entryRepository::loadUnread
EntryStatus.HISTORY -> entryRepository::loadRead EntryStatus.HISTORY -> entryRepository::loadRead