mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-22 12:03:09 -04:00
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:
parent
8462128b70
commit
f990e1cffb
@ -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 {
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user