From 7845a5e5dbce3873c7e3b0743e78314f9f55f45f Mon Sep 17 00:00:00 2001 From: Ray Ryan Date: Thu, 1 Aug 2024 13:38:50 -0700 Subject: [PATCH] Reverts ComposeView `ViewCompositionStrategy` to default. This was the first attempt to fix dead `ComposeView` instances in shuffled `Dialog` windows, but it breaks other things. Still seems like the right thing to do, but maybe that ship has sailed. If the need comes up again, consider adding a `ViewEnvironment` property to allow customizing it (yuck). --- .../squareup/workflow1/ui/compose/ScreenComposableFactory.kt | 2 -- 1 file changed, 2 deletions(-) diff --git a/workflow-ui/compose/src/main/java/com/squareup/workflow1/ui/compose/ScreenComposableFactory.kt b/workflow-ui/compose/src/main/java/com/squareup/workflow1/ui/compose/ScreenComposableFactory.kt index 9a0745438c..5b1c28777d 100644 --- a/workflow-ui/compose/src/main/java/com/squareup/workflow1/ui/compose/ScreenComposableFactory.kt +++ b/workflow-ui/compose/src/main/java/com/squareup/workflow1/ui/compose/ScreenComposableFactory.kt @@ -10,7 +10,6 @@ import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.remember import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.LocalLifecycleOwner -import androidx.compose.ui.platform.ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed import androidx.compose.ui.viewinterop.AndroidView import androidx.lifecycle.setViewTreeLifecycleOwner import com.squareup.workflow1.ui.Screen @@ -126,7 +125,6 @@ public fun ScreenComposableFactory.asViewFactory(): container: ViewGroup? ): ScreenViewHolder { val view = ComposeView(context) - view.setViewCompositionStrategy(DisposeOnViewTreeLifecycleDestroyed) return ScreenViewHolder(initialEnvironment, view) { newRendering, environment -> // Update the state whenever a new rendering is emitted.