Thread
#compose
    Colton Idle

    Colton Idle

    1 year ago
    Alright, so this was definitely working yesterday and now it's not today and I've spent 3 hours trying to figure out why my composable isn't recomposing when the list contents change. Code in thread.
    Here is my composable
    Crossfade(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.
    Unless this is hitting me again https://issuetracker.google.com/issues/188860479 /shruggie
    Halil Ozercan

    Halil Ozercan

    1 year ago
    Unless this is hitting me again https://issuetracker.google.com/issues/188860479
    Crossing 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

    Colton Idle

    1 year ago
    Got it. BE changed a model without telling anyone. 😭
    Crossing this off should be rather easy by uninstalling the app and reinstalling
    If only it were that easy. Builds seems to work, and then not work. And then sometimes old builds are somehow installed. 😭
    a

    Abhishek Dewan

    1 year ago
    fwiw I’ve noticed this with the latest android betas only. Whenever I run my api 29 emulator the issue of old builds getting installed goes away