diff --git a/package.json b/package.json
index 499952a441..4407fd33f3 100644
--- a/package.json
+++ b/package.json
@@ -58,7 +58,7 @@
"lint": "yarn run lint:eslint && yarn run lint:prettier",
"lint:fix:eslint": "eslint --fix --max-warnings=0 packages qa-core",
"lint:fix:prettier": "prettier --write \"packages/**/*.{js,ts,svelte}\" && prettier --write \"examples/**/*.{js,ts,svelte}\" && prettier --write \"qa-core/**/*.{js,ts,svelte}\"",
- "lint:fix": "yarn run lint:fix:prettier && yarn run lint:fix:eslint",
+ "lint:fix": "yarn run lint:fix:eslint && yarn run lint:fix:prettier",
"build:specs": "lerna run --stream specs",
"build:docker:airgap": "node hosting/scripts/airgapped/airgappedDockerBuild",
"build:docker:airgap:single": "SINGLE_IMAGE=1 node hosting/scripts/airgapped/airgappedDockerBuild",
diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js
index 55208bb97e..fd492cca0b 100644
--- a/packages/builder/src/builderStore/store/frontend.js
+++ b/packages/builder/src/builderStore/store/frontend.js
@@ -39,6 +39,7 @@ import { makePropSafe as safe } from "@budibase/string-templates"
import { getComponentFieldOptions } from "helpers/formFields"
import { createBuilderWebsocket } from "builderStore/websocket"
import { BuilderSocketEvent } from "@budibase/shared-core"
+import componentTreeNodesStore from "stores/portal/componentTreeNodesStore"
const INITIAL_FRONTEND_STATE = {
initialised: false,
@@ -1053,6 +1054,7 @@ export const getFrontendStore = () => {
const screen = get(selectedScreen)
const parent = findComponentParent(screen.props, componentId)
const index = parent?._children.findIndex(x => x._id === componentId)
+ const componentTreeNodes = get(componentTreeNodesStore)
// Check for screen and navigation component edge cases
const screenComponentId = `${screen._id}-screen`
@@ -1071,9 +1073,15 @@ export const getFrontendStore = () => {
if (index > 0) {
// If sibling before us accepts children, select a descendant
const previousSibling = parent._children[index - 1]
- if (previousSibling._children?.length) {
+ if (
+ previousSibling._children?.length &&
+ componentTreeNodes[`nodeOpen-${previousSibling._id}`]
+ ) {
let target = previousSibling
- while (target._children?.length) {
+ while (
+ target._children?.length &&
+ componentTreeNodes[`nodeOpen-${target._id}`]
+ ) {
target = target._children[target._children.length - 1]
}
return target._id
@@ -1093,6 +1101,7 @@ export const getFrontendStore = () => {
const screen = get(selectedScreen)
const parent = findComponentParent(screen.props, componentId)
const index = parent?._children.findIndex(x => x._id === componentId)
+ const componentTreeNodes = get(componentTreeNodesStore)
// Check for screen and navigation component edge cases
const screenComponentId = `${screen._id}-screen`
@@ -1102,7 +1111,11 @@ export const getFrontendStore = () => {
}
// If we have children, select first child
- if (component._children?.length) {
+ if (
+ component._children?.length &&
+ (state.selectedComponentId === navComponentId ||
+ componentTreeNodes[`nodeOpen-${component._id}`])
+ ) {
return component._children[0]._id
} else if (!parent) {
return null
diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentDropdownMenu.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentDropdownMenu.svelte
index 4645ee0d41..baaa561679 100644
--- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentDropdownMenu.svelte
+++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/_components/ComponentList/ComponentDropdownMenu.svelte
@@ -3,6 +3,7 @@
import { ActionMenu, MenuItem, Icon } from "@budibase/bbui"
export let component
+ export let opened
$: definition = componentStore.getDefinition(component?._component)
$: noPaste = !$componentStore.componentToPaste
@@ -85,6 +86,39 @@
>
Paste
+
+ {#if component?._children?.length}
+
+
+
+
+ {/if}