diff --git a/packages/builder/src/components/design/settings/controls/FormStepConfiguration.svelte b/packages/builder/src/components/design/settings/controls/FormStepConfiguration.svelte index bd28347e08..2941821dec 100644 --- a/packages/builder/src/components/design/settings/controls/FormStepConfiguration.svelte +++ b/packages/builder/src/components/design/settings/controls/FormStepConfiguration.svelte @@ -6,7 +6,7 @@ import { Helpers } from "@budibase/bbui" import { derived, writable } from "svelte/store" import { Utils } from "@budibase/frontend-core" - import { cloneDeep } from "lodash" + import { cloneDeep, isEqual } from "lodash" export let componentInstance export let componentBindings @@ -21,21 +21,32 @@ const currentStep = derived(multiStepStore, state => state.currentStep) const componentType = "@budibase/standard-components/multistepformblockstep" + let cachedValue + let cachedInstance = {} + + $: if (!isEqual(cachedValue, value)) { + cachedValue = value + } + + $: if (!isEqual(componentInstance, cachedInstance)) { + cachedInstance = componentInstance + } + setContext("multi-step-form-block", multiStepStore) - $: stepCount = value?.length || 0 + $: stepCount = cachedValue?.length || 0 $: updateStore(stepCount) - $: dataSource = getDatasourceForProvider($currentAsset, componentInstance) + $: dataSource = getDatasourceForProvider($currentAsset, cachedInstance) $: emitCurrentStep($currentStep) $: stepLabel = getStepLabel($multiStepStore) $: stepDef = getDefinition(stepLabel) - $: stepSettings = value?.[$currentStep] || {} + $: stepSettings = cachedValue?.[$currentStep] || {} $: defaults = Utils.buildMultiStepFormBlockDefaultProps({ - _id: componentInstance._id, + _id: cachedInstance._id, stepCount: $multiStepStore.stepCount, currentStep: $multiStepStore.currentStep, - actionType: componentInstance.actionType, - dataSource: componentInstance.dataSource, + actionType: cachedInstance.actionType, + dataSource: cachedInstance.dataSource, }) $: stepInstance = { _id: Helpers.uuid(), 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 aeaa577455..052c06b213 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 @@ -7,6 +7,7 @@ $: definition = store.actions.components.getDefinition(component?._component) $: noPaste = !$store.componentToPaste $: isBlock = definition?.block === true + $: canEject = !(definition?.ejectable === false) const keyboardEvent = (key, ctrlKey = false) => { document.dispatchEvent( @@ -32,7 +33,7 @@ > Delete - {#if isBlock} + {#if isBlock && canEject} { - componentToEject = component - confirmEjectDialog.show() + const definition = store.actions.components.getDefinition( + component._component + ) + const isBlock = definition?.block === true + const canEject = !(definition?.ejectable === false) + if (isBlock && canEject) { + componentToEject = component + confirmEjectDialog.show() + } }, ["Ctrl+Enter"]: () => { $goto(`./:componentId/new`) diff --git a/packages/pro b/packages/pro index b1c10c2daf..8c466d6ef2 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit b1c10c2daf808d103724c324256cbff67f33fb46 +Subproject commit 8c466d6ef2a0c09b843ef63276793ab5af2e96f7