Просмотр исходного кода

fix: 发现页首页筛选问题

HapeLee 5 месяцев назад
Родитель
Сommit
74618447cd

+ 8 - 0
app/src/main/java/io/legado/app/ui/book/explore/ExploreShowScreen.kt

@@ -167,6 +167,14 @@ fun ExploreShowScreen(
         }
     }
 
+    // Auto-load next page when filter removes all books on the current page
+    // but the ViewModel hasn't reached the end of data yet.
+    LaunchedEffect(books.isEmpty(), state.isLoading, state.isEnd, state.books.size) {
+        if (books.isEmpty() && !state.isLoading && !state.isEnd && state.books.isNotEmpty()) {
+            viewModel.onIntent(ExploreShowIntent.ForceLoadNext)
+        }
+    }
+
     LaunchedEffect(isGridMode) {
         if (isGridMode) {
             if (listState.firstVisibleItemIndex > 0) {