Closed Barros9 closed 4 years ago
You can fix this issue by updating updateState methods like this https://github.com/eric-ampire/android-mvi-architecture/commit/eccd908aa438ef081fc35b75892f2247eafa8e4b
private suspend fun updateState(handler: suspend (intent: UserState) -> UserState) {
_state.postValue(handler(state.value!!))
}
Great, thank you!
First, good example and good article on medium. If I turn off internet connection the app crash, could be it's trying to get "userApi.getUser()" on main thread? I moved userApi.getUser() in a variable and I pass it to the updateState and now it works. What do you think? I'm trying to understand the behavior with coroutines.