[fenix] Closes https://github.com/mozilla-mobile/fenix/issues/24276: fix history list displaying empty state until refresh

pull/600/head
mike a 3 years ago committed by mergify[bot]
parent e076435191
commit 7c3131c3d0

@ -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