From c37834935f44a3f4d25889fefb95e133ed21f89b Mon Sep 17 00:00:00 2001 From: fscarponi Date: Wed, 13 Sep 2023 15:21:44 +0200 Subject: [PATCH] Remove InitialNodeStatus from LazyTree usage --- core/src/main/kotlin/org/jetbrains/jewel/LazyTree.kt | 3 --- .../jetbrains/jewel/foundation/tree/BasicLazyTree.kt | 10 ---------- 2 files changed, 13 deletions(-) diff --git a/core/src/main/kotlin/org/jetbrains/jewel/LazyTree.kt b/core/src/main/kotlin/org/jetbrains/jewel/LazyTree.kt index d184b7707..bf7d48a4e 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/LazyTree.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/LazyTree.kt @@ -9,7 +9,6 @@ import androidx.compose.ui.res.ResourceLoader import org.jetbrains.jewel.foundation.lazy.SelectableLazyItemScope import org.jetbrains.jewel.foundation.tree.BasicLazyTree import org.jetbrains.jewel.foundation.tree.DefaultTreeViewKeyActions -import org.jetbrains.jewel.foundation.tree.InitialNodeStatus import org.jetbrains.jewel.foundation.tree.KeyBindingActions import org.jetbrains.jewel.foundation.tree.Tree import org.jetbrains.jewel.foundation.tree.TreeElementState @@ -21,7 +20,6 @@ import org.jetbrains.jewel.styling.LazyTreeStyle @Composable fun LazyTree( tree: Tree, - initialNodeStatus: InitialNodeStatus = InitialNodeStatus.Close, resourceLoader: ResourceLoader, modifier: Modifier = Modifier, onElementClick: (Tree.Element) -> Unit = {}, @@ -36,7 +34,6 @@ fun LazyTree( val metrics = style.metrics BasicLazyTree( tree = tree, - initialNodeStatus = initialNodeStatus, onElementClick = onElementClick, elementBackgroundFocused = colors.elementBackgroundFocused, elementBackgroundSelectedFocused = colors.elementBackgroundSelectedFocused, diff --git a/core/src/main/kotlin/org/jetbrains/jewel/foundation/tree/BasicLazyTree.kt b/core/src/main/kotlin/org/jetbrains/jewel/foundation/tree/BasicLazyTree.kt index 98da9be89..f12958483 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/foundation/tree/BasicLazyTree.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/foundation/tree/BasicLazyTree.kt @@ -13,7 +13,6 @@ import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.CornerSize import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable -import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.Immutable import androidx.compose.runtime.Stable import androidx.compose.runtime.getValue @@ -75,7 +74,6 @@ import kotlin.time.Duration.Companion.milliseconds @Composable fun BasicLazyTree( tree: Tree, - initialNodeStatus: InitialNodeStatus, selectionMode: SelectionMode = SelectionMode.Multiple, onElementClick: (Tree.Element) -> Unit, elementBackgroundFocused: Color, @@ -114,14 +112,6 @@ fun BasicLazyTree( } } - DisposableEffect(tree, treeState.allNodes.size) { - if (initialNodeStatus == InitialNodeStatus.Open) { - treeState.openNodes.clear() - treeState.openNodes.addAll(treeState.allNodes.map { it.first }) - } - onDispose { } - } - SelectableLazyColumn( modifier = modifier, state = treeState.delegate,