diff --git a/app/src/main/java/me/ash/reader/ui/page/home/feeds/FeedsPage.kt b/app/src/main/java/me/ash/reader/ui/page/home/feeds/FeedsPage.kt index a3cee9dfe..bcc9d23c9 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/feeds/FeedsPage.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/feeds/FeedsPage.kt @@ -113,7 +113,7 @@ fun FeedsPage( feedsViewModel.fetchAccount() } - LaunchedEffect(filterUiState) { + LaunchedEffect(filterUiState, isSyncing) { snapshotFlow { filterUiState }.collect { feedsViewModel.pullFeeds(it) } diff --git a/app/src/main/java/me/ash/reader/ui/page/home/feeds/FeedsViewModel.kt b/app/src/main/java/me/ash/reader/ui/page/home/feeds/FeedsViewModel.kt index 866f0d48e..4d1a5128e 100644 --- a/app/src/main/java/me/ash/reader/ui/page/home/feeds/FeedsViewModel.kt +++ b/app/src/main/java/me/ash/reader/ui/page/home/feeds/FeedsViewModel.kt @@ -43,8 +43,9 @@ class FeedsViewModel @Inject constructor( val isStarred = filterState.filter.isStarred() val isUnread = filterState.filter.isUnread() _feedsUiState.update { + val important = rssService.get().pullImportant(isStarred, isUnread) it.copy( - importantSum = rssService.get().pullImportant(isStarred, isUnread) + importantSum = important .mapLatest { (it["sum"] ?: 0).run { androidStringsHelper.getQuantityString( @@ -59,7 +60,7 @@ class FeedsViewModel @Inject constructor( } }.flowOn(defaultDispatcher), groupWithFeedList = combine( - rssService.get().pullImportant(isStarred, isUnread), + important, rssService.get().pullFeeds() ) { importantMap, groupWithFeedList -> val groupIterator = groupWithFeedList.iterator()