epoxy icon indicating copy to clipboard operation
epoxy copied to clipboard

Is passing viewModel state good practice?

Open Veeksi opened this issue 3 years ago • 0 comments
trafficstars

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?

Veeksi avatar Jun 01 '22 10:06 Veeksi