diff --git a/test-app/presenter/build.gradle b/test-app/presenter/build.gradle index 6e9e0c90b6..34f67c42c6 100644 --- a/test-app/presenter/build.gradle +++ b/test-app/presenter/build.gradle @@ -19,6 +19,7 @@ kotlin { implementation projects.testApp.schema.compose implementation projects.redwoodLazylayoutCompose implementation projects.redwoodProtocolCompose + implementation libs.jetbrains.compose.runtime.saveable implementation libs.paging.compose.common implementation libs.kotlinx.coroutines.core } diff --git a/test-app/presenter/src/commonMain/kotlin/com/example/redwood/testing/presenter/TestApp.kt b/test-app/presenter/src/commonMain/kotlin/com/example/redwood/testing/presenter/TestApp.kt index 75c90e17b2..3577c5d216 100644 --- a/test-app/presenter/src/commonMain/kotlin/com/example/redwood/testing/presenter/TestApp.kt +++ b/test-app/presenter/src/commonMain/kotlin/com/example/redwood/testing/presenter/TestApp.kt @@ -19,7 +19,7 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.MutableState import androidx.compose.runtime.Stable import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.remember +import androidx.compose.runtime.saveable.rememberSaveable import app.cash.redwood.Modifier import app.cash.redwood.compose.BackHandler import app.cash.redwood.layout.api.Constraint.Companion.Fill @@ -44,7 +44,7 @@ class TestContext( @Composable fun TestApp(context: TestContext) { - val screenKeyState = remember { mutableStateOf(null) } + val screenKeyState = rememberSaveable { mutableStateOf(null) } val screenKey = screenKeyState.value if (screenKey == null) { ScreenList(screenKeyState)