fix(history): resolve session resume profile scoping and history pagination (#1040)
This commit is contained in:
5 files changed
+64
-10
No files matched your search
@@ -804,9 +804,13 @@ fun SessionsScreen(
|
||||
derivedStateOf {
|
||||
val info = listState.layoutInfo
|
||||
val lastVisible = info.visibleItemsInfo.lastOrNull()?.index ?: -1
|
||||
lastVisible >= 0 &&
|
||||
info.totalItemsCount >= AUTO_LOAD_THRESHOLD &&
|
||||
if (lastVisible < 0 || info.totalItemsCount == 0) {
|
||||
false
|
||||
} else if (info.totalItemsCount <= AUTO_LOAD_THRESHOLD) {
|
||||
lastVisible >= info.totalItemsCount - 1
|
||||
} else {
|
||||
lastVisible >= info.totalItemsCount - AUTO_LOAD_THRESHOLD
|
||||
}
|
||||
}
|
||||
}
|
||||
LaunchedEffect(
|
||||
|
||||
@@ -216,11 +216,6 @@ class SessionsViewModel :
|
||||
val hasMore = receivedFullPage && addedNewItems && data.total > newSessions.size
|
||||
it.copy(
|
||||
isLoadingMore = false,
|
||||
// distinctBy guards offset-pagination churn: if a new
|
||||
// session lands on top between page loads, offsets
|
||||
// shift and the next page can repeat an id we already
|
||||
// have — LazyColumn would crash on the duplicate key.
|
||||
// pinnedFirst keeps pinned sessions above the rest.
|
||||
sessions = newSessions,
|
||||
total = if (hasMore) data.total else newSessions.size,
|
||||
hasMore = hasMore,
|
||||
|
||||
Reference in new issue
Block a user