gumil

    gumil

    2 years ago
    TextButton and OutlinedButton's children aren't updated by
    @Model
    classes. I suspect that the
    noinline
    might have affected this. It works okay using a plain button
    l

    Leland Richardson [G]

    2 years ago
    can you provide an example?
    gumil

    gumil

    2 years ago
    @Model
    data class CounterState(var count: Int = 0)
    
    @Composable
    fun Counter(state: CounterState) {
        TextButton(
            onClick = {
                state.count++
            }
        ) {
            Text(
                text = "I've been clicked ${state.count} times"
            )
        }
    }
    In this case state.count++ gets executed and updated. but Text won't be updated. While debugging it, also doesn't rewrite the Text component.
    l

    Leland Richardson [G]

    2 years ago
    and it does if you use a different Button composable?
    gumil

    gumil

    2 years ago
    If i just use Button, it does work
    l

    Leland Richardson [G]

    2 years ago
    hmm. that is definitely odd
    do you mind filing a quick bug for this to track?
    gumil

    gumil

    2 years ago
    sure