Encountered a bug in beta05 where `Image`s don't r...
# compose
d
Encountered a bug in beta05 where `Image`s don't recompose properly.
Copy code
@Composable
fun BugRepro() {
    val images = listOf(
        Icons.Default.Home,
        Icons.Default.LocalActivity
    )

    var index by remember { mutableStateOf(1) }

    Image(
        imageVector = images[index],
        contentDescription = null,
        modifier = Modifier
            .width((50 + index * 50).dp) // Just so they're different sizes
            .height(76.dp)
    )

    LaunchedEffect(key1 = Unit) {
        delay(1000)
        index--
        delay(1000)
        index++
    }
}
If anyone else is having this problem wrapping the Image with a
key
is a valid workaround.
🙏 1
t
Did you try to remember the image instead of the index? Maybe this will also help? But i am not sure.