Closes #24276: fix history list displaying empty state until refresh

upstream-sync
mike a 2 years ago committed by mergify[bot]
parent 386c4da765
commit b934f3659c

@ -36,12 +36,17 @@ class HistoryView(
val historyAdapter = HistoryAdapter(interactor).apply {
addLoadStateListener {
adapterItemCount = itemCount
Log.d("hehehaha", "adapterItemCount = $adapterItemCount")
// first call will always have itemCount == 0, but we want to keep adapterItemCount
// as null until we can distinguish an empty list from populated, so updateEmptyState()
// could work correctly
if (itemCount != 0) {
adapterItemCount = itemCount
}
if (it.source.refresh is LoadState.NotLoading &&
it.append.endOfPaginationReached &&
itemCount < 1
) {
adapterItemCount = 0
onZeroItemsLoaded.invoke()
}
}

Loading…
Cancel
Save