With the update to Compose 2025.04.01 we observe f...
# compose
l
With the update to Compose 2025.04.01 we observe flaky behavior in a screen with two composables inside a Theme:
Copy code
override fun onCreate(...) {
    setContent {
        uiState by viewModel.uiState.collectAsStateWithLifecycle()
            
        MyTheme {
            MyScreen(uiState)
            (uiState.overlayState as? ScannedItemOvelayState)?.let { scannedItemOverlayState ->
                MyOverlay(scannedItemOverlayState)
            }        
        }
    }
}
The flakiness is that
MyOverlay
is sometimes not hidden even though
showOverlay
is null. However, when I wrap those both composables in a
Box
,
MyOverlay
is hidden reliably every time.
Is there some rule that the lambda inside a
MaterialTheme
has to only produce one composable?