Why does appending 2 values onto `SnapshotStateLis...
# compose
u
Why does appending 2 values onto
SnapshotStateList
appear atomic? I figured it would recompose twice but does seems to only once. Is it only recomposing come VSync time? Is this guaranteed? (Real use case is navigation 3 where I want to push multiple screens, or rather mutate backstack more deeply and it needs to be in one "transaction")
Copy code
val list = remember { mutableStateListOf("") }
Column(
    modifier = Modifier
        .fillMaxSize()
) {
    for (item in list) {
        Text(item)
    }
    Button(
        onClick = {
            list += "Hello"
            list += "World"
        }
    ) {
        Text("Click me")
    }
}
Or the nav use case ..
Copy code
backStack.removeLastOrNull()
backStack += NewScreen(data = ...)
i
If it is on the main thread (like in an onClick), that is atomic, yes: https://issuetracker.google.com/issues/455129597#comment2
u
nice, thanks!