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

SrSouza

10/29/2019, 6:57 PM
Hi guys, anyone getting crash changing the button style when is clicked? My code:
Copy code
@Model
object MyHomeState {
    var isDoingSomething = false

    fun turnDoingSomething() {
        isDoingSomething = !isDoingSomething
    }
}

@Composable
private fun MyHomeContent() {
    Padding(32.dp) {
        Row {
            Button(
                style = if(!MyHomeState.isDoingSomething) ContainedButtonStyle() else OutlinedButtonStyle(),
                onClick = if(MyHomeState.isDoingSomething) null else MyHomeState::turnDoingSomething
            ) {
                Text("START")
            }
            WidthSpacer(width = 16.dp)
            Button(
                style = if(MyHomeState.isDoingSomething) ContainedButtonStyle() else OutlinedButtonStyle(),
                onClick = if(!MyHomeState.isDoingSomething) null else MyHomeState::turnDoingSomething
            ) {
                Text("STOP")
            }
        }
    }
}
j

jim

10/29/2019, 7:01 PM
cc @Chuck Jazdzewski [G] any ideas here?
c

Chuck Jazdzewski [G]

10/29/2019, 7:58 PM
Whenever the exception "Expected a group start" indicates that there is an internal problem in either the compiler plugin or the runtime or both. In this case there, the effects use a constant key and sometime result in this kind of issue. They should be using a compiler generated group key and then the runtime would know that the effect being requested is in someway different (e.g. the
memo
as a different number of parameters) than the effect that was at this spot in the composition. Since they both use the same key sometimes the composer gets confused causing this issue. Please report this as a bug and we can work around it in
Ripple.kt
. Eventually, when we switch to using the unary
+
to converting effects to be
@Composable
functions, this type of issue will go away.
s

SrSouza

10/29/2019, 8:16 PM
c

Chuck Jazdzewski [G]

10/29/2019, 9:00 PM
Thanks!