(forgive me if there’s a better channel, I wasn’t sure which of the compose channels to raise compiler related discussion in)
When updating Jetbrains’ compose-compiler from 1.5.10.2 to 1.5.13.3, I noticed a subtle change that surprised me. The behavior might be correct, but I don’t fully understand why. The snippet I’m testing this is:
Column {
var text2Enabled by rememberRetained { mutableStateOf(true) }
val text1 by rememberRetained { mutableStateOf("Text") }
Text(modifier = Modifier.testTag(TAG_RETAINED_1), text = text1)
Button(
modifier = Modifier.testTag("TAG_BUTTON"),
onClick = { text2Enabled = !text2Enabled },
) {
Text("Toggle")
}
if (text2Enabled) {
val text2 by rememberRetained { mutableStateOf("Text") }
Text(modifier = Modifier.testTag(TAG_RETAINED_2), text = text2)
}
}
On 1.5.10.2, the first two
rememberRetained
calls have the same
currentCompositeKeyHash
, and the third one (under text2Enabled) is different.
On 1.5.13.3, all three of them have the same
currentCompositeKeyHash
. Is that expected?