Skip to content

Commit

Permalink
timeline : makes sure to emit empty list if initial reset has no item.
Browse files Browse the repository at this point in the history
  • Loading branch information
ganfra committed Sep 25, 2024
1 parent 14dc0da commit 2a0ea1e
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,14 @@ internal class TimelineItemsSubscriber(
}

private suspend fun postItems(items: List<TimelineItem>) = coroutineScope {
// Split the initial items in multiple list as there is no pagination in the cached data, so we can post timelineItems asap.
items.chunked(INITIAL_MAX_SIZE).reversed().forEach {
ensureActive()
timelineDiffProcessor.postItems(it)
if (items.isEmpty()) {
timelineDiffProcessor.postItems(emptyList())
} else {
// Split the initial items in multiple list as there is no pagination in the cached data, so we can post timelineItems asap.
items.chunked(INITIAL_MAX_SIZE).reversed().forEach {
ensureActive()
timelineDiffProcessor.postItems(it)
}
}
isTimelineInitialized.value = true
initLatch.complete(Unit)
Expand Down

0 comments on commit 2a0ea1e

Please sign in to comment.