fix empty timeline on initial load (#2586)
This commit is contained in:
parent
2e33233309
commit
dba2fbc5c1
4 changed files with 10 additions and 4 deletions
|
@ -267,8 +267,11 @@ class CachedTimelineViewModel @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
override fun invalidate() {
|
||||
currentPagingSource?.invalidate()
|
||||
override suspend fun invalidate() {
|
||||
// invalidating when we don't have statuses yet can cause empty timelines because it cancels the network load
|
||||
if (db.timelineDao().getStatusCount(accountManager.activeAccount!!.id) > 0) {
|
||||
currentPagingSource?.invalidate()
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
|
|
@ -249,7 +249,7 @@ class NetworkTimelineViewModel @Inject constructor(
|
|||
currentSource?.invalidate()
|
||||
}
|
||||
|
||||
override fun invalidate() {
|
||||
override suspend fun invalidate() {
|
||||
currentSource?.invalidate()
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ abstract class TimelineViewModel(
|
|||
abstract fun fullReload()
|
||||
|
||||
/** Triggered when currently displayed data must be reloaded. */
|
||||
protected abstract fun invalidate()
|
||||
protected abstract suspend fun invalidate()
|
||||
|
||||
protected fun shouldFilterStatus(statusViewData: StatusViewData): Boolean {
|
||||
val status = statusViewData.asStatusOrNull()?.status ?: return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue