fix(search): expire stale results after an empty query
Stale rows from an earlier query flashed during the next load. Clear the cache when a finished query has no results.
This commit is contained in:
1 parent
c440fc5024
commit
98b23bac48
1 file changed
+2
-2
@@ -89,8 +89,8 @@ internal fun SearchResultsPane(
|
|||||||
|
|
||||||
SideEffect {
|
SideEffect {
|
||||||
val loaded = results.itemSnapshotList.items
|
val loaded = results.itemSnapshotList.items
|
||||||
if (results.loadState.refresh is LoadState.NotLoading && loaded.isNotEmpty()) {
|
if (results.loadState.refresh is LoadState.NotLoading) {
|
||||||
staleEntries = loaded
|
staleEntries = if (loaded.isNotEmpty()) loaded else emptyList()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val pendingReload = results.itemCount == 0 &&
|
val pendingReload = results.itemCount == 0 &&
|
||||||
|
|||||||
Reference in new issue
Block a user