Merge branch 'master' into fix/cluster-mode

This commit is contained in:
Michael Drury 2024-02-15 12:59:53 +00:00 committed by GitHub
commit 83aba40090
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 4 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "2.19.3", "version": "2.19.4",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*", "packages/*",

View File

@ -29,6 +29,7 @@ import {
} from "constants/backend" } from "constants/backend"
import BudiStore from "./BudiStore" import BudiStore from "./BudiStore"
import { Utils } from "@budibase/frontend-core" import { Utils } from "@budibase/frontend-core"
import componentTreeNodesStore from "stores/portal/componentTreeNodesStore"
export const INITIAL_COMPONENTS_STATE = { export const INITIAL_COMPONENTS_STATE = {
components: {}, components: {},
@ -662,6 +663,7 @@ export class ComponentStore extends BudiStore {
const screen = get(selectedScreen) const screen = get(selectedScreen)
const parent = findComponentParent(screen.props, componentId) const parent = findComponentParent(screen.props, componentId)
const index = parent?._children.findIndex(x => x._id === componentId) const index = parent?._children.findIndex(x => x._id === componentId)
const componentTreeNodes = get(componentTreeNodesStore)
// Check for screen and navigation component edge cases // Check for screen and navigation component edge cases
const screenComponentId = `${screen._id}-screen` const screenComponentId = `${screen._id}-screen`
@ -680,9 +682,15 @@ export class ComponentStore extends BudiStore {
if (index > 0) { if (index > 0) {
// If sibling before us accepts children, select a descendant // If sibling before us accepts children, select a descendant
const previousSibling = parent._children[index - 1] const previousSibling = parent._children[index - 1]
if (previousSibling._children?.length) { if (
previousSibling._children?.length &&
componentTreeNodes[`nodeOpen-${previousSibling._id}`]
) {
let target = previousSibling let target = previousSibling
while (target._children?.length) { while (
target._children?.length &&
componentTreeNodes[`nodeOpen-${target._id}`]
) {
target = target._children[target._children.length - 1] target = target._children[target._children.length - 1]
} }
return target._id return target._id
@ -703,6 +711,7 @@ export class ComponentStore extends BudiStore {
const screen = get(selectedScreen) const screen = get(selectedScreen)
const parent = findComponentParent(screen.props, componentId) const parent = findComponentParent(screen.props, componentId)
const index = parent?._children.findIndex(x => x._id === componentId) const index = parent?._children.findIndex(x => x._id === componentId)
const componentTreeNodes = get(componentTreeNodesStore)
// Check for screen and navigation component edge cases // Check for screen and navigation component edge cases
const screenComponentId = `${screen._id}-screen` const screenComponentId = `${screen._id}-screen`
@ -712,7 +721,11 @@ export class ComponentStore extends BudiStore {
} }
// If we have children, select first child // 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 return component._children[0]._id
} else if (!parent) { } else if (!parent) {
return null return null