Colton Idle
08/04/2021, 6:22 PMCrossfade(targetState = viewModel.state.list.isEmpty()) { empty ->
when (empty) {
true -> {
//show spinner
false -> {
//show list
Now the crossfade has been working fine for weeks. Here is the VM code
is ApiResult.Success -> {
state.list = result.response.myViews
}
class HomeScreenViewState {
var list by mutableStateOf(listOf<MyViews>())
Again, this definitely worked.
Things I've tried:
1. Logging that ApiResult is successful
2. Moved to mutableStateListOf
3. debugging to make sure the list isEmpty
4. Removed the crossfade entirely and always try showing the list all the time. Nothing shows. So it seems like the list isn't being triggered as being mutable.
Conclusion I've come to is that I've been doing this all wrong the entire time and it was only working because it was a fluke, and so now I just want another set of eyes on this.Halil Ozercan
08/04/2021, 8:04 PMUnless this is hitting me again https://issuetracker.google.com/issues/188860479Crossing this off should be rather easy by uninstalling the app and reinstalling 😄 For the issue, there seems to be nothing wrong from what you shared. Only things that can go wrong are • ViewModel gets reinitialized during recomposition cycle? (low prob) • State in your ViewModel is not singleton and it gets reinitialized? (slightly low prob) • The code that actually shows your list doesn't get the latest "list" in your state
Colton Idle
08/04/2021, 8:57 PMCrossing this off should be rather easy by uninstalling the app and reinstallingIf only it were that easy. Builds seems to work, and then not work. And then sometimes old builds are somehow installed. 😭
Abhishek Dewan
08/05/2021, 5:36 AM