Skip to content

Commit

Permalink
Reuse filter
Browse files Browse the repository at this point in the history
  • Loading branch information
jocmp committed Dec 3, 2024
1 parent fe1cb66 commit 8746a7c
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.paging.PagingData
import androidx.paging.compose.LazyPagingItems
import androidx.paging.compose.collectAsLazyPagingItems
import com.capyreader.app.R
import com.capyreader.app.common.Media
Expand Down Expand Up @@ -117,7 +116,7 @@ fun ArticleLayout(
val scaffoldNavigator = rememberListDetailPaneScaffoldNavigator()
var isRefreshing by remember { mutableStateOf(false) }
val pagingArticles = articles.collectAsLazyPagingItems(Dispatchers.IO)
val listState = rememberArticleListState(pagingArticles)
val listState = rememberArticleListState(filter)
val snackbarHost = remember { SnackbarHostState() }
val addFeedSuccessMessage = stringResource(R.string.add_feed_success)
val currentFeed = findCurrentFeed(filter, allFeeds)
Expand Down Expand Up @@ -469,8 +468,8 @@ fun findCurrentFeed(filter: ArticleFilter, feeds: List<Feed>): Feed? {


@Composable
fun rememberArticleListState(articles: LazyPagingItems<Article>): LazyListState {
return rememberSaveable(articles.itemCount, saver = LazyListState.Saver) {
fun rememberArticleListState(filter: ArticleFilter): LazyListState {
return rememberSaveable(filter, saver = LazyListState.Saver) {
LazyListState()
}
}
Expand Down

0 comments on commit 8746a7c

Please sign in to comment.