Fixed: Online library sometimes automatically loaded more items without user input.

* Removed the code that auto-scrolled the list to show the progress bar. Now, users will see the progress bar only when they scroll down to load more items.
* Improved `isLoadingMoreItem` handling to avoid duplicate `loadMore` calls after appending items
This commit is contained in:
MohitMaliFtechiz 2025-08-20 13:18:45 +05:30 committed by Kelson
parent 8462128b70
commit f990e1cffb
2 changed files with 1 additions and 9 deletions

View File

@ -215,14 +215,6 @@ private fun OnlineLibraryList(state: OnlineLibraryScreenState, lazyListState: La
showLoadMoreProgressBar(state.isLoadingMoreItem)
}
LaunchedEffect(state.isLoadingMoreItem) {
if (state.isLoadingMoreItem) {
// Scroll to the last item (i.e., the loading spinner)
val lastItemIndex = state.onlineLibraryList?.size ?: 0
lazyListState.animateScrollToItem(lastItemIndex)
}
}
LaunchedEffect(lazyListState) {
snapshotFlow {
derivedStateOf {

View File

@ -513,6 +513,7 @@ class ZimManageViewModel @Inject constructor(
}
}
.collect { result ->
resetDownloadState()
library.emit(
if (result.onlineLibraryRequest.isLoadMoreItem) {
library.value + result.books
@ -520,7 +521,6 @@ class ZimManageViewModel @Inject constructor(
result.books
}
)
resetDownloadState()
}
}
}.flowOn(ioDispatcher)