Marcin Wisniowski
09/18/2024, 10:36 PMSharedTransitionLayout
currently not usable with LazyColumn
?
After putting much work getting the animations to work perfectly, the LazyColumn
now often crashes when scrolled.
https://issuetracker.google.com/issues/336140982
Bug is marked as fixed, but that version of Compose is not released for Desktop use, and someone already commented it isn't fixed anyway.Doris Liu
09/19/2024, 3:49 AMMarcin Wisniowski
09/19/2024, 8:40 AMMarcin Wisniowski
09/19/2024, 9:35 AMmovableContentOf
in the children of the LazyColumn
that is in a SharedTransitionLayout
. I removed movableContentOf
from my list items and the crashing is gone.Doris Liu
09/19/2024, 5:09 PMmovableContentOf
and LazyColumn
combo, and steps to trigger crash, I can help verify if the fix from the issue above fixes this crash using 1.8.0-alpha01.Doris Liu
09/19/2024, 5:17 PMMarcin Wisniowski
09/19/2024, 9:45 PM@OptIn(ExperimentalSharedTransitionApi::class)
fun main() {
singleWindowApplication {
var items by remember { mutableStateOf(List(500) { it }) }
LaunchedEffect(Unit) {
while (true) {
delay(10)
items = items.shuffled()
}
}
SharedTransitionLayout {
LazyColumn {
items(items, key = { it }) {
val movableContent = remember { movableContentOf { Text("Item $it") } }
Box(Modifier.animateItem()) {
Box {
movableContent()
}
}
}
}
}
}
}
Doris Liu
09/19/2024, 9:55 PMjava.lang.IllegalArgumentException: measure is called on a deactivated node
as I tried it out locally.Marcin Wisniowski
09/19/2024, 9:55 PMException in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Error: Placement happened before lookahead.
at androidx.compose.ui.internal.InlineClassHelperKt.throwIllegalStateException(InlineClassHelper.kt:26)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.placeSelf-MLgxB_4(LayoutNodeLayoutDelegate.kt:2105)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.placeAt-f8xVGno(LayoutNodeLayoutDelegate.kt:767)
at androidx.compose.ui.layout.Placeable.access$placeAt-f8xVGno(Placeable.kt:35)
at androidx.compose.ui.layout.Placeable$PlacementScope.place-70tqf50(Placeable.kt:621)
at androidx.compose.ui.layout.Placeable$PlacementScope.place-70tqf50$default(Placeable.kt:259)
Doris Liu
09/19/2024, 9:58 PMProcess: androidx.compose.animation.demos.test, PID: 32685
java.lang.IllegalArgumentException: measure is called on a deactivated node
at androidx.compose.ui.internal.InlineClassHelperKt.throwIllegalArgumentException(InlineClassHelper.kt:34)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.remeasure-BRTryo0(LayoutNodeLayoutDelegate.kt:2071)
at androidx.compose.ui.node.LayoutNodeLayoutDelegate$MeasurePassDelegate.measure-BRTryo0(LayoutNodeLayoutDelegate.kt:668)
at androidx.compose.foundation.lazy.layout.LazyLayoutMeasureScopeImpl.measure-0kLqBqw(LazyLayoutMeasureScope.kt:125)
at androidx.compose.foundation.lazy.LazyListMeasuredItemProvider.getAndMeasure-0kLqBqw(LazyListMeasuredItemProvider.kt:55)
at androidx.compose.foundation.lazy.LazyListMeasuredItemProvider.getAndMeasure--hBUhpc(LazyListMeasuredItemProvider.kt:43)
at androidx.compose.foundation.lazy.LazyListMeasuredItemProvider.getAndMeasure--hBUhpc(LazyListMeasuredItemProvider.kt:28)
at androidx.compose.foundation.lazy.layout.LazyLayoutItemAnimator.onMeasured(LazyLayoutItemAnimator.kt:255)
at androidx.compose.foundation.lazy.LazyListMeasureKt.measureLazyList-LCrQqZ4(LazyListMeasure.kt:366)
at androidx.compose.foundation.lazy.LazyListKt$rememberLazyListMeasurePolicy$1$1.invoke-0kLqBqw(LazyList.kt:350)
at androidx.compose.foundation.lazy.LazyListKt$rememberLazyListMeasurePolicy$1$1.invoke(LazyList.kt:198)
at androidx.compose.foundation.lazy.layout.LazyLayoutKt$LazyLayout$1$2$1.invoke-0kLqBqw(LazyLayout.kt:78)
at androidx.compose.foundation.lazy.layout.LazyLayoutKt$LazyLayout$1$2$1.invoke(LazyLayout.kt:76)
at androidx.compose.ui.layout.LayoutNodeSubcompositionsState$createMeasurePolicy$1.measure-3p2s80s(SubcomposeLayout.kt:730)
at androidx.compose.ui.node.InnerNodeCoordinator.measure-BRTryo0(InnerNodeCoordinator.kt:127)
Marcin Wisniowski
09/19/2024, 9:59 PMMarcin Wisniowski
09/19/2024, 9:59 PM1.7.0-beta02
now of JetBrains ComposeDoris Liu
09/19/2024, 10:00 PMDoris Liu
09/20/2024, 12:10 AMMarcin Wisniowski
09/20/2024, 12:20 AMmovableContentOf
from my application fixed the crashing, if it isn't what triggers this issue after all.Marcin Wisniowski
09/21/2024, 10:03 PMmovableContentOf
only apparently resolved this issue for me. Although it doesn't crash almost immediately now, it still crashes – just very rarely. I'm removing the SharedTransitionLayout
for now and hopefully I can add it back at some point.Doris Liu
09/24/2024, 1:41 AMMarcin Wisniowski
01/08/2025, 2:59 AMMarcin Wisniowski
02/13/2025, 10:47 AMMarcin Wisniowski
02/13/2025, 7:02 PMDoris Liu
02/14/2025, 6:34 PMMarcin Wisniowski
02/14/2025, 6:56 PMorg.jetbrains.compose:1.8.0-alpha03
, which uses 1.8.0-beta01
of Jetpack Compose.