Skip to content

Commit d804fe4

Browse files
committed
Replace redundant collectLatest
The called code is not cancellable via structured concurrency
1 parent 76f8220 commit d804fe4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

app/src/main/kotlin/com/fibelatti/pinboard/features/posts/presentation/PostListViewModel.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import com.fibelatti.pinboard.features.posts.domain.usecase.GetRecentPosts
3030
import dagger.hilt.android.lifecycle.HiltViewModel
3131
import javax.inject.Inject
3232
import kotlinx.coroutines.CoroutineScope
33-
import kotlinx.coroutines.flow.collectLatest
3433
import kotlinx.coroutines.flow.launchIn
3534
import kotlinx.coroutines.flow.mapNotNull
3635
import kotlinx.coroutines.launch
@@ -48,7 +47,7 @@ class PostListViewModel @Inject constructor(
4847
scope.launch {
4948
appStateRepository.appState
5049
.mapNotNull { appState -> appState.content.find<PostListContent>() }
51-
.collectLatest { content: PostListContent ->
50+
.collect { content: PostListContent ->
5251
val shouldLoadContent: Boolean = content.shouldLoad is ShouldLoadFirstPage ||
5352
content.shouldLoad is ShouldForceLoad ||
5453
content.shouldLoad is ShouldLoadNextPage

0 commit comments

Comments
 (0)