diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte index fa126bbc99..ae5866d12e 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/AppPreview.svelte @@ -10,6 +10,7 @@ navigationStore, selectedScreen, hoverStore, + componentTreeNodesStore, } from "stores/builder" import ConfirmDialog from "components/common/ConfirmDialog.svelte" import { @@ -130,6 +131,13 @@ error = event.error || "An unknown error occurred" } else if (type === "select-component" && data.id) { componentStore.select(data.id) + + const componentPath = findComponentPath( + $selectedScreen?.props, + data.id + ).map(component => component._id) + + componentTreeNodesStore.expandNodes(componentPath) } else if (type === "hover-component") { hoverStore.hover(data.id, false) } else if (type === "update-prop") { diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentKeyHandler.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentKeyHandler.svelte index f6bbac39a5..df0d361290 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentKeyHandler.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentKeyHandler.svelte @@ -4,12 +4,12 @@ selectedScreen, componentStore, selectedComponent, + componentTreeNodesStore } from "stores/builder" import { findComponent } from "helpers/components" import { goto, isActive } from "@roxi/routify" import { notifications } from "@budibase/bbui" import ConfirmDialog from "components/common/ConfirmDialog.svelte" - import componentTreeNodesStore from "stores/portal/componentTreeNodesStore" let confirmDeleteDialog let confirmEjectDialog @@ -66,6 +66,7 @@ componentTreeNodesStore.expandNode(component._id) }, ["ArrowLeft"]: component => { + componentStore.select(component._id) componentTreeNodesStore.collapseNode(component._id) }, ["Ctrl+ArrowRight"]: component => { @@ -83,6 +84,7 @@ expandChildren(component) }, ["Ctrl+ArrowLeft"]: component => { + componentStore.select(component._id) componentTreeNodesStore.collapseNode(component._id) const collapseChildren = component => { diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentTree.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentTree.svelte index f24235ad07..b8e5720eea 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentTree.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentTree.svelte @@ -7,8 +7,8 @@ componentStore, userSelectedResourceMap, selectedComponent, - selectedComponentPath, hoverStore, + componentTreeNodesStore } from "stores/builder" import { findComponentPath, @@ -17,7 +17,6 @@ } from "helpers/components" import { get } from "svelte/store" import { dndStore } from "./dndStore" - import componentTreeNodesStore from "stores/portal/componentTreeNodesStore" export let components = [] export let level = 0 @@ -64,14 +63,11 @@ } } - const isOpen = (component, selectedComponentPath, openNodes) => { + const isOpen = (component, openNodes) => { if (!component?._children?.length) { return false } - if (selectedComponentPath.slice(0, -1).includes(component._id)) { - return true - } - return openNodes[`nodeOpen-${component._id}`] + return openNodes[`nodeOpen-${component._id}`] !== false } const isChildOfSelectedComponent = component => { @@ -90,7 +86,7 @@