diff --git a/packages/builder/src/components/automation/AutomationBuilder/AutomationBuilder.svelte b/packages/builder/src/components/automation/AutomationBuilder/AutomationBuilder.svelte index caeb33cb14..9952826be3 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/AutomationBuilder.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/AutomationBuilder.svelte @@ -3,8 +3,8 @@ import Flowchart from "./FlowChart/FlowChart.svelte" -{#if $selectedAutomation} - {#key $selectedAutomation._id} - +{#if $selectedAutomation?.data} + {#key $selectedAutomation.data._id} + {/key} {/if} diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte index 653d567b13..f95de759c8 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte @@ -27,10 +27,13 @@ ActionStepID.TRIGGER_AUTOMATION_RUN, ] - $: blockRef = $automationStore.blocks?.[block.id] + $: blockRef = $selectedAutomation.blockRefs?.[block.id] $: lastStep = blockRef?.terminating $: pathSteps = block.id - ? automationStore.actions.getPathSteps(blockRef.pathTo, $selectedAutomation) + ? automationStore.actions.getPathSteps( + blockRef.pathTo, + $selectedAutomation?.data + ) : [] $: collectBlockExists = pathSteps?.some( @@ -81,7 +84,7 @@ // Filter out Collect block if not App Action or Webhook if ( !collectBlockAllowedSteps.includes( - $selectedAutomation.definition.trigger.stepId + $selectedAutomation.data.definition.trigger.stepId ) ) { delete acc.COLLECT diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/BranchNode.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/BranchNode.svelte index 86c6263b70..739dad2204 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/BranchNode.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/BranchNode.svelte @@ -28,6 +28,7 @@ export let step export let isLast export let bindings + export let automation let drawer let condition @@ -85,13 +86,14 @@
{ await automationStore.actions.deleteBranch( branchBlockRef.pathTo, - $selectedAutomation + $selectedAutomation.data ) }} on:update={async e => { @@ -103,7 +105,7 @@ const updatedAuto = automationStore.actions.updateStep( pathTo, - $selectedAutomation, + $selectedAutomation.data, stepUpdate ) await automationStore.actions.save(updatedAuto) @@ -115,7 +117,7 @@ on:click={() => { automationStore.actions.branchLeft( branchBlockRef.pathTo, - $selectedAutomation, + $selectedAutomation.data, step ) }} @@ -130,7 +132,7 @@ on:click={() => { automationStore.actions.branchRight( branchBlockRef.pathTo, - $selectedAutomation, + $selectedAutomation.data, step ) }} diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte index 2361fc2ba3..1f78fc9398 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte @@ -1,8 +1,8 @@ {#if isBranch} @@ -51,6 +60,7 @@ >
{ - const autoTrigger = $selectedAutomation?.definition?.trigger + const autoTrigger = $selectedAutomation.data?.definition?.trigger const { tableId } = autoTrigger?.inputs || {} // Ensure the tableId matches the trigger table for row trigger automations @@ -62,12 +62,12 @@ return true } - const memoTestData = memo(parseTestData($selectedAutomation.testData)) - $: memoTestData.set(parseTestData($selectedAutomation.testData)) + const memoTestData = memo(parseTestData($selectedAutomation.data.testData)) + $: memoTestData.set(parseTestData($selectedAutomation.data.testData)) $: { // clone the trigger so we're not mutating the reference - trigger = cloneDeep($selectedAutomation.definition.trigger) + trigger = cloneDeep($selectedAutomation.data.definition.trigger) // get the outputs so we can define the fields let schema = Object.entries(trigger.schema?.outputs?.properties || {}) @@ -110,7 +110,10 @@ const testAutomation = async () => { try { - await automationStore.actions.test($selectedAutomation, $memoTestData) + await automationStore.actions.test( + $selectedAutomation.data, + $memoTestData + ) $automationStore.showTestPanel = true } catch (error) { notifications.error(error) @@ -158,7 +161,7 @@ {#if selectedJSON}