airbnb / epoxy

Epoxy is an Android library for building complex screens in a RecyclerView
https://goo.gl/eIK82p
Apache License 2.0
8.46k stars 730 forks source link

Is passing viewModel state good practice? #1295

Open Veeksi opened 2 years ago

Veeksi commented 2 years ago

Like, if I have UiState like this defined in my viewModel:

data class UiState(
        val isLoading: Boolean = false,
        val hasError: Boolean = false,
        val errorMessage: String = "",
        val category: Category = Category.MOVIE,
        val discoveredMovies: List<Movie> = emptyList(),
        val discoveredSeries: List<Serie> = emptyList()
 )

Is it bad to pass the whole state to TypedEpoxyController? Because otherwise I should define methods submitMovieData and submitSerieData etc in fragment level.

And also when the controller complicates and depends on even more properties, how shold I use it then?