Skip to content

Commit

Permalink
Only display "No result" in the NotLoading state
Browse files Browse the repository at this point in the history
  • Loading branch information
MGaetan89 committed Nov 2, 2023
1 parent 606e00a commit 8de327d
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ private fun SearchResultList(
buClicked: (Bu) -> Unit,
modifier: Modifier = Modifier
) {
val hasNoResult = lazyPagingItems.loadState.refresh is LoadState.NotLoading &&
lazyPagingItems.itemCount == 1 &&
lazyPagingItems[0] is SearchContent.BuSelector

LazyColumn(modifier = modifier) {
items(count = lazyPagingItems.itemCount, key = lazyPagingItems.itemKey()) { index ->
val item = lazyPagingItems[index]
Expand Down Expand Up @@ -134,8 +138,7 @@ private fun SearchResultList(
}
}
}
// We didn't receive any results
if (lazyPagingItems.itemCount == 1 && lazyPagingItems[0] is SearchContent.BuSelector) {
if (hasNoResult) {
item {
NoResult(
modifier = Modifier
Expand Down

0 comments on commit 8de327d

Please sign in to comment.