Why doesn't ReusableContentHost clean up remember ...
# compose
s
Why doesn't ReusableContentHost clean up remember in slottable?
Copy code
setContent {
    var active by remember { mutableStateOf(true) }
    Box {
        ReusableContentHost(active) {
            val innerData = remember { mutableStateOf("Za") }
        }
    }
    val outerData = remember { mutableStateOf("Zb") }
    val composition = currentComposer.composition
    LaunchedEffect(active) {
        // !!! When active changes from true to false, the Za stored in the slottable still remains and has not been cleaned up.
        // Group(25) key=207, nodes=0, size=2 aux=false, slots=[86: false]
        //   Group(26) key=-1685893985, nodes=0, size=1, slots=[87: σ(value=Za]
        composition.printSlotTable()
    }
    Box(
        Modifier
            .fillMaxSize()
            .clickable {
                active = !active
                Log.e("clickable", "$active")
            }) { }
}
As mentioned in the source code comments: When
active
is false, the content is deactivated and all remembered state is treated as if the content was deleted. Could it be that my understanding is wrong, or that my example doesn’t match the function's functionality?