From b59b4e1736f1654e598aba62174eaec470475ae3 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Tue, 5 Nov 2024 16:08:24 +0100 Subject: [PATCH] Use updated test data --- .../AutomationBuilder/FlowChart/TestDataModal.svelte | 11 +++++------ .../automation/SetupPanel/AutomationBlockSetup.svelte | 10 +++++++++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte index c2890c50c1..914fcd2f62 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte @@ -64,8 +64,7 @@ return true } - const memoTestData = memo(parseTestData($selectedAutomation.testData)) - $: memoTestData.set(parseTestData($selectedAutomation.testData)) + $: testData = testData || parseTestData($selectedAutomation.testData) $: { // clone the trigger so we're not mutating the reference @@ -84,7 +83,7 @@ $: isError = !isTriggerValid(trigger) || !(trigger.schema.outputs.required || []).every( - required => $memoTestData?.[required] || required !== "row" + required => testData?.[required] || required !== "row" ) function parseTestJSON(e) { @@ -111,10 +110,10 @@ } const testAutomation = async () => { - // Ensure $memoTestData reactiveness is processed + // Ensure testData reactiveness is processed await tick() try { - await automationStore.actions.test($selectedAutomation, $memoTestData) + await automationStore.actions.test($selectedAutomation, testData) $automationStore.showTestPanel = true } catch (error) { notifications.error(error) @@ -152,7 +151,7 @@ {#if selectedValues}
{ + const onChange = async update => { + if (isTestModal) { + testData = update + } + + updateAutomation(update) + } + + const updateAutomation = Utils.sequential(async update => { const request = cloneDeep(update) // Process app trigger updates if (isTrigger && !isTestModal) {