Is it possible that that mutableStateOf doesn't ca...
# compose
m
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)
I tried to describe problem in the following gist https://gist.github.com/SumeraMartin/c381c4553333efbdcebc6a4bd8f7a1e5
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
@martinsumera I'm wondering if you need to call .value on the state inside your snapshotFlow function
Copy code
snapshotFlow { viewModel.viewState.screenState.value }.collect {
    Log($it) // This prints correct value
}
m
Nope, it was mistake during copy-pasting of the code