Skip to content

Commit

Permalink
Catch exception on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbel committed Oct 25, 2024
1 parent ceba5cb commit 496e9be
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flowOf
Expand Down Expand Up @@ -38,9 +39,5 @@ class FeedViewModel(

val pagingDataFlow: StateFlow<List<MoviePojo>> = currentMovieList.flatMapLatest { movieList ->
flowOf(interactor.moviesResult(movieList.nameOrLocalList))
}.stateIn(
scope = viewModelScope,
started = SharingStarted.Lazily,
initialValue = emptyList()
)
}.catch { emptyList<List<MoviePojo>>() }.stateIn(scope = viewModelScope, started = SharingStarted.Lazily, initialValue = emptyList())
}

0 comments on commit 496e9be

Please sign in to comment.