Skip to content

Commit

Permalink
Fix posts not showing in home screen when active source is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
msasikanth committed Apr 18, 2024
1 parent 544291f commit ad6f7c7
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.distinctUntilChangedBy
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.map
Expand Down Expand Up @@ -263,17 +264,17 @@ class HomePresenter(
}
}

rssRepository.featuredPosts(
selectedFeedId = activeSource?.id,
unreadOnly = unreadOnly,
after = postsAfter
)
rssRepository
.featuredPosts(
selectedFeedId = activeSource?.id,
unreadOnly = unreadOnly,
after = postsAfter
)
.map { Triple(it, postsType, activeSource) }
}
.distinctUntilChanged()
.onEach { featuredPosts ->
.distinctUntilChangedBy { (featuredPosts, _, _) -> featuredPosts }
.onEach { (featuredPosts, postsType, activeSource) ->
val featuredPostIds = featuredPosts.map { it.id }
val postsType = _state.value.postsType
val activeSource = _state.value.activeSource

val unreadOnly =
when (postsType) {
Expand Down

0 comments on commit ad6f7c7

Please sign in to comment.