From 86a5977c9b3058a764ed596055f133434268c0d6 Mon Sep 17 00:00:00 2001 From: Igor Demin Date: Wed, 11 Nov 2020 16:48:08 +0300 Subject: [PATCH 1/2] Regression in Todo example app after multiple Compose updates Closes https://github.com/JetBrains/compose-jb/issues/86 --- .../example/todo/common/edit/ui/TodoEditUi.kt | 2 +- .../example/todo/common/main/ui/TodoMainUi.kt | 2 +- .../jvmMain/kotlin/example/todo/desktop/Main.kt | 17 +++++++++-------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/examples/todoapp/common/edit/src/commonMain/kotlin/example/todo/common/edit/ui/TodoEditUi.kt b/examples/todoapp/common/edit/src/commonMain/kotlin/example/todo/common/edit/ui/TodoEditUi.kt index 0b1e954a02..ed0c97b1e4 100644 --- a/examples/todoapp/common/edit/src/commonMain/kotlin/example/todo/common/edit/ui/TodoEditUi.kt +++ b/examples/todoapp/common/edit/src/commonMain/kotlin/example/todo/common/edit/ui/TodoEditUi.kt @@ -1,7 +1,6 @@ package example.todo.common.edit.ui import androidx.compose.foundation.Icon -import androidx.compose.foundation.Text import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer @@ -10,6 +9,7 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.material.Checkbox import androidx.compose.material.IconButton +import androidx.compose.material.Text import androidx.compose.material.TextField import androidx.compose.material.TopAppBar import androidx.compose.material.icons.Icons diff --git a/examples/todoapp/common/main/src/commonMain/kotlin/example/todo/common/main/ui/TodoMainUi.kt b/examples/todoapp/common/main/src/commonMain/kotlin/example/todo/common/main/ui/TodoMainUi.kt index 62d693e27d..527f104100 100644 --- a/examples/todoapp/common/main/src/commonMain/kotlin/example/todo/common/main/ui/TodoMainUi.kt +++ b/examples/todoapp/common/main/src/commonMain/kotlin/example/todo/common/main/ui/TodoMainUi.kt @@ -1,6 +1,5 @@ package example.todo.common.main.ui -import androidx.compose.foundation.Text import androidx.compose.foundation.clickable import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column @@ -17,6 +16,7 @@ import androidx.compose.material.Divider import androidx.compose.material.Icon import androidx.compose.material.IconButton import androidx.compose.material.OutlinedTextField +import androidx.compose.material.Text import androidx.compose.material.TopAppBar import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Delete diff --git a/examples/todoapp/desktop/src/jvmMain/kotlin/example/todo/desktop/Main.kt b/examples/todoapp/desktop/src/jvmMain/kotlin/example/todo/desktop/Main.kt index 7577352fb1..04c6d0b0a3 100644 --- a/examples/todoapp/desktop/src/jvmMain/kotlin/example/todo/desktop/Main.kt +++ b/examples/todoapp/desktop/src/jvmMain/kotlin/example/todo/desktop/Main.kt @@ -1,6 +1,5 @@ package example.todo.desktop -import androidx.compose.desktop.AppWindow import androidx.compose.desktop.DesktopTheme import androidx.compose.desktop.Window import androidx.compose.foundation.layout.fillMaxSize @@ -24,17 +23,19 @@ fun main() { val lifecycle = LifecycleRegistry() lifecycle.resume() + val todoRoot = TodoRoot( + componentContext = DefaultComponentContext(lifecycle), + dependencies = object : TodoRoot.Dependencies { + override val storeFactory = DefaultStoreFactory + override val database = TodoDatabase(TodoDatabaseDriver()) + } + ) + Window("Todo") { Surface(modifier = Modifier.fillMaxSize()) { MaterialTheme { DesktopTheme { - TodoRoot( - componentContext = DefaultComponentContext(lifecycle), - dependencies = object : TodoRoot.Dependencies { - override val storeFactory = DefaultStoreFactory - override val database = TodoDatabase(TodoDatabaseDriver()) - } - ).invoke() + todoRoot.invoke() } } } From 28935cfe87324a7b667c30375bcaee6758324bdb Mon Sep 17 00:00:00 2001 From: Igor Demin Date: Wed, 11 Nov 2020 17:24:07 +0300 Subject: [PATCH 2/2] Todo example, refactoring --- .../desktop/src/jvmMain/kotlin/example/todo/desktop/Main.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/todoapp/desktop/src/jvmMain/kotlin/example/todo/desktop/Main.kt b/examples/todoapp/desktop/src/jvmMain/kotlin/example/todo/desktop/Main.kt index 04c6d0b0a3..5969f242d6 100644 --- a/examples/todoapp/desktop/src/jvmMain/kotlin/example/todo/desktop/Main.kt +++ b/examples/todoapp/desktop/src/jvmMain/kotlin/example/todo/desktop/Main.kt @@ -35,7 +35,7 @@ fun main() { Surface(modifier = Modifier.fillMaxSize()) { MaterialTheme { DesktopTheme { - todoRoot.invoke() + todoRoot() } } }