https://kotlinlang.org logo
#compose
Title
# compose
g

gumil

03/05/2020, 7:50 PM
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]

03/05/2020, 7:54 PM
can you provide an example?
g

gumil

03/05/2020, 7:55 PM
Copy code
@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]

03/05/2020, 9:50 PM
and it does if you use a different Button composable?
g

gumil

03/05/2020, 10:03 PM
If i just use Button, it does work
l

Leland Richardson [G]

03/05/2020, 10:07 PM
hmm. that is definitely odd
do you mind filing a quick bug for this to track?
g

gumil

03/05/2020, 10:10 PM
sure
3 Views