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

Zsolt

12/17/2019, 8:56 PM
Just noticed that changing a var in a @Model annotated class constructor doesn't trigger recomposition, only if the var is declared in the class body.
l

Leland Richardson [G]

12/17/2019, 8:57 PM
can you provide an example?
z

Zsolt

12/17/2019, 9:02 PM
Copy code
@Model
class Foo(private var bar: Int) {

}

// vs:

@Model
class Foo {
    private var bar: Int
}
l

Leland Richardson [G]

12/17/2019, 9:55 PM
Really? I was definitely under the impression that that worked
z

Zsolt

12/18/2019, 12:26 AM
That was the only difference at the time I wrote, and rolled it back and forth a couple of times. Worked one way, didn't work the other. I moved on with the working version and now I can no longer reproduce it and it feels stupid.
l

Leland Richardson [G]

12/18/2019, 1:13 AM
note that one issue that we are aware of is @Model is not doing anything on inner/nested classes
which is just a bug
but it gets ppl a lot
that could have been what you were seeing