Cleanups
This commit is contained in:
parent
048d56456c
commit
79180bfac5
|
@ -1,7 +1,7 @@
|
|||
import { get } from "svelte/store"
|
||||
import { selectedScreen as selectedScreenStore } from "./screens"
|
||||
import { findComponentPath } from "@/helpers/components"
|
||||
import { Screen, Component } from "@budibase/types"
|
||||
import { Component } from "@budibase/types"
|
||||
import { BudiStore, PersistenceType } from "@/stores/BudiStore"
|
||||
|
||||
interface OpenNodesState {
|
||||
|
@ -49,9 +49,9 @@ export class ComponentTreeNodesStore extends BudiStore<OpenNodesState> {
|
|||
|
||||
// Will ensure all parents of a node are expanded so that it is visible in the tree
|
||||
makeNodeVisible(componentId: string) {
|
||||
const selectedScreen: Screen = get(selectedScreenStore)!
|
||||
const selectedScreen = get(selectedScreenStore)
|
||||
|
||||
const path = findComponentPath(selectedScreen.props, componentId)
|
||||
const path = findComponentPath(selectedScreen?.props, componentId)
|
||||
|
||||
const componentIds = path.map((component: Component) => component._id)
|
||||
|
||||
|
|
|
@ -610,14 +610,14 @@ export class ComponentStore extends BudiStore<ComponentState> {
|
|||
async patch(
|
||||
patchFn: (component: Component, screen: Screen) => any,
|
||||
componentId?: string,
|
||||
screenId?: string | null
|
||||
screenId?: string
|
||||
) {
|
||||
// Use selected component by default
|
||||
if (!componentId || !screenId) {
|
||||
const state = get(this.store)
|
||||
componentId = componentId ?? state.selectedComponentId ?? undefined
|
||||
const screenState = get(screenStore)
|
||||
screenId = screenId || screenState.selectedScreenId
|
||||
screenId = (screenId || screenState.selectedScreenId) ?? undefined
|
||||
}
|
||||
if (!componentId || !screenId || !patchFn) {
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue