Sergio
03/23/2023, 9:03 PMjava.lang.IllegalStateException: Reading a state that was created after the snapshot was taken or in a snapshot that has not yet been applied
for this composable when doing a state read in the layout scope. The problem doesn't occur when I change using graphicsLayer
from the lambda style (layout layer update) to the parameters arguments one (composition layer)Sergio
03/23/2023, 9:03 PMSergio
03/23/2023, 9:03 PMSergio
03/23/2023, 9:05 PMSergio
03/23/2023, 9:07 PMgraphicsLayer
modifiers no more crash 😕Sergio
03/23/2023, 9:08 PMStylianos Gakis
03/23/2023, 10:47 PMSergio
03/23/2023, 11:03 PM.graphicsLayer {
translationX = (if (rightSide) displacement.dp else -displacement.dp).toPx()
translationY = constraints.maxHeight.toFloat() * normalizedOffsetPosition
}
but if I use parameters it doesn't crash
.graphicsLayer(
translationY = constraints.maxHeight.toFloat() * normalizedOffsetPosition,
translationX = with(LocalDensity.current) { (if (rightSide) displacement.dp else -displacement.dp).toPx() }
)
Sergio
03/23/2023, 11:08 PMSergio
03/23/2023, 11:13 PMCaused by: java.lang.IllegalStateException: Reading a state that was created after the snapshot was taken or in a snapshot that has not yet been applied
implies I'm reading state before the snapshot was applied or before created, the only place that might happen is in the a coroutine call inside the local function setScrollOffset
that is called from a listener (global snapshot, but that should still work)Sergio
03/24/2023, 1:26 AMZach Klippenstein (he/him) [MOD]
03/29/2023, 3:45 PM