Is it possible that that mutableStateOf doesn't cause recomposition. I have a flaky test and it looks like that recomposition is not happening sometimes and I can't find out why. (code is in the thread)
Basically, the state is changed. I have verified it with logs, but it is not propagated to the Content composable which doesn't change and that cause failing test. I never happened on real device. It happens sometimes on the emulator.
Basically I click on the button, change the state, the state is changed but recomposition is not happening sometimes.
ScreenState is enum so there shouldn't be a problem with comparing different values. I changed it to the boolean but it didn't work either.
m
mattinger
02/22/2022, 2:25 PM
@martinsumera I'm wondering if you need to call .value on the state inside your snapshotFlow function
snapshotFlow { viewModel.viewState.screenState.value }.collect {
Log($it) // This prints correct value
}
m
martinsumera
02/22/2022, 3:12 PM
Nope, it was mistake during copy-pasting of the code