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)
val errorMessage = _errorMessage.asStateFlow()
protected open val entryStatus: EntryStatus? = null
private val pagingSource: EntryAndFeedPagingSource
get() = EntryAndFeedPagingSource(entryRepository, entryStatus)
private lateinit var pagingSource: EntryAndFeedPagingSource
val entries = Pager(PagingConfig(pageSize = 15)) {
pagingSource
EntryAndFeedPagingSource(entryRepository, entryStatus).also {
pagingSource = it
}
}.flow.cachedIn(viewModelScope)
fun dismissError() {

View file

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