:thinking_face: Would you try this snippet and see...
# compose
s
🤔 Would you try this snippet and see what it prints? I think there's an unwanted behavior under the hood... 🐛🧵
Copy code
class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContent {
            val isVisible by produceState(false) { value = true }
            AnimatedVisibility(isVisible) { Bar() }
        }
    }
}

@Composable
fun Bar() {
    println("[${System.currentTimeMillis()}] Recomposition...")

    val context = LocalContext.current
    val flag by remember { mutableStateOf(0) }
    val items = remember { mutableStateListOf<Int>() }

    LaunchedEffect(flag) {
        if (flag == 0) items.clear()
        delay(100)
        items.add(0)
    }

    LazyColumn {
        context
        items(items) {}
    }
}