diff --git a/packages/builder/src/builderStore/store/automation/index.js b/packages/builder/src/builderStore/store/automation/index.js index 16cc490bb2..50a1f476ef 100644 --- a/packages/builder/src/builderStore/store/automation/index.js +++ b/packages/builder/src/builderStore/store/automation/index.js @@ -87,7 +87,7 @@ const automationActions = store => ({ const response = await api.post(`/api/automations/${_id}/test`, testData) const json = await response.json() store.update(state => { - state.selectedAutomation.testResults = json + state.selectedAutomation.automation.testResults = json return state }) }, diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte index 7ddc5c3e48..5ce55437be 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte @@ -25,9 +25,10 @@ let resultsModal let setupToggled let blockComplete - $: testResult = $automationStore.selectedAutomation.testResults?.steps.filter( - step => step.stepId === block.stepId - ) + $: testResult = + $automationStore.selectedAutomation.automation.testResults?.steps.filter( + step => step.stepId === block.stepId + ) $: isTrigger = block.type === "TRIGGER" diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index 874a0e68eb..e7208518d5 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -51,31 +51,31 @@ : { schema: {} } $: schemaFields = table ? Object.values(table.schema) : [] - const onChange = debounce( - async function (e, key) { - if (isTestModal) { - // Special case for webhook, as it requires a body, but the schema already brings back the body's contents - if (stepId === "WEBHOOK") { - automationStore.actions.addTestDataToAutomation({ - body: { - [key]: e.detail, - ...$automationStore.selectedAutomation.automation.testData.body, - }, - }) - } + const onChange = debounce(async function (e, key) { + if (isTestModal) { + // Special case for webhook, as it requires a body, but the schema already brings back the body's contents + if (stepId === "WEBHOOK") { automationStore.actions.addTestDataToAutomation({ - [key]: e.detail, + body: { + [key]: e.detail, + ...$automationStore.selectedAutomation.automation.testData.body, + }, }) - testData[key] = e.detail - } else { - block.inputs[key] = e.detail - await automationStore.actions.save( - $automationStore.selectedAutomation?.automation - ) } - }, - isTestModal ? 0 : 800 - ) + automationStore.actions.addTestDataToAutomation({ + [key]: e.detail, + }) + testData[key] = e.detail + await automationStore.actions.save( + $automationStore.selectedAutomation?.automation + ) + } else { + block.inputs[key] = e.detail + await automationStore.actions.save( + $automationStore.selectedAutomation?.automation + ) + } + }, 800) function getAvailableBindings(block, automation) { if (!block || !automation) {