is this exception known `Layer is redrawn for Layo...
# compose
m
is this exception known
Layer is redrawn for LayoutNode in state NeedsRelayout
?
a
no, it is not expected for sure. did you reproduce it on alpha05? could you please file a bug if you can stable reproduce it?
m
thanks, this is the code maybe something i am doing wrong
Copy code
@Composable
fun Test() {
    val state = rememberLazyListState()
    val selectedIndex = if (state.firstVisibleItemScrollOffset > 120) {
        state.firstVisibleItemIndex + 1
    } else {
        state.firstVisibleItemIndex
    }.coerceIn(0, 9)

    LazyRowForIndexed(
        items = (0..10).toList(),
        state = state,
    ) { index, item ->
            Card(
                modifier = Modifier
                    .padding(horizontal = 4.dp, vertical = 16.dp)
                    .width(
                        animate(target = if (selectedIndex == index) 200.dp else 100.dp)
                    )
                    .height(120.dp),
            ) {
                val imageId = when(index % 3) {
                    0 -> R.drawable.surffing_1
                    1 -> R.drawable.surrfing_2
                    else -> R.drawable.surffing_3
                }
                Image(
                    asset = imageResource(id = imageId),
                    contentScale = ContentScale.Crop
                )
            }
    }
}
when i remove the Image no crashes happens. should i file a bug?
a
is it on alpha05?
m
yes
a
Thanks. I filled a bug to investigate it: https://issuetracker.google.com/issues/171309350
m
thanks
should i file a bug from the beginning next time?
a
it is completely fine to ask here first if it is a known issue already before filling
👍 1
v
Just wanted to chime in since I can’t seem to comment on the issue directly. I’m getting the same error with a LazyColumn. For additional error info
Layer is redrawn for LayoutNode in state NeedsRelayout [LayoutNode@80444f4 children: 0 measureBlocks: MeasuringIntrinsicsMeasureBlocks@f8be41d{ measureBlock=androidx.compose.foundation.ImageKt$Image$1$1@97f2692 }]
. It may possibly be image related, I haven’t looked to deeply into it but it happens intermittently as my list paginates.
a
on what version of compose?
v
1.0.0-alpha06
is supposedly also an issue in the jetsnack sample app as well https://github.com/android/compose-samples/issues/236
a
i just started seeing the issue vincent is seeing as well on alpha07
j
I'm experiencing the same issue in alpha07. Didn't have this exception on alpha05 (skipped 06).
a
it should be fixed in alpha08
a
I’m getting slightly different error:
Layer is redrawn for LayoutNode in state NeedsRemeasure
Is this the same issue with same fix?
a
most likely yes
a
glad to hear! 🙏