fix(ui): read paging snapshot directly
Replace the per-index peek loop with the item snapshot list; the loop walked the whole result set on every recomposition.
This commit is contained in:
1 parent
b5fc7e7246
commit
71fea4472b
1 file changed
+1
-7
@@ -80,13 +80,7 @@ internal fun SearchResultsPane(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val loaded = ArrayList<IndexEntry>(results.itemCount)
|
val loaded = results.itemSnapshotList.items.filterNotNull()
|
||||||
for (index in 0 until results.itemCount) {
|
|
||||||
val entry = results.peek(index)
|
|
||||||
if (entry != null) {
|
|
||||||
loaded.add(entry)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SideEffect {
|
SideEffect {
|
||||||
if (results.loadState.refresh is LoadState.NotLoading && loaded.isNotEmpty()) {
|
if (results.loadState.refresh is LoadState.NotLoading && loaded.isNotEmpty()) {
|
||||||
staleEntries = loaded
|
staleEntries = loaded
|
||||||
|
|||||||
Reference in new issue
Block a user