Don't scroll to top on refresh in local favorites

This commit is contained in:
FooIbar committed 2023-12-08 16:08:55 +08:00
1 parent a6f5e4f98d
commit 70f952285a
2 files changed
+3 -1

No files matched your search

@@ -77,6 +77,7 @@ fun GalleryList(
thumbListState: LazyStaggeredGridState = rememberLazyStaggeredGridState(),
thumbItemContent: @Composable (LazyStaggeredGridItemScope.(BaseGalleryInfo) -> Unit),
refreshState: PullToRefreshState,
scrollToTopOnRefresh: Boolean = true,
onRefresh: suspend CoroutineScope.() -> Unit,
onLoading: suspend CoroutineScope.() -> Unit,
) {
@@ -176,7 +177,7 @@ fun GalleryList(
val dialogState = LocalDialogState.current
when (val state = data.loadState.refresh) {
is LoadState.Loading -> if (!refreshState.isRefreshing) {
is LoadState.Loading -> if (!refreshState.isRefreshing && scrollToTopOnRefresh) {
LaunchedEffect(Unit) {
onLoading()
}
@@ -307,6 +307,7 @@ fun FavouritesScreen(navigator: DestinationsNavigator) {
}
},
refreshState = refreshState,
scrollToTopOnRefresh = urlBuilder.favCat != FavListUrlBuilder.FAV_CAT_LOCAL,
onRefresh = { refresh() },
onLoading = { searchBarOffsetY = 0 },
)