diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte index 5ec66870a8..eebd977e6c 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/TestDataModal.svelte @@ -46,7 +46,7 @@ } } else { // Leave the core data as it is - return testData + return cloneDeep(testData) } } @@ -63,7 +63,10 @@ return true } - $: testData = testData || parseTestData($selectedAutomation.data.testData) + $: currentTestData = $selectedAutomation.data.testData + + // Can be updated locally to avoid race condition when testing + $: testData = parseTestData(currentTestData) $: { // clone the trigger so we're not mutating the reference @@ -85,7 +88,7 @@ required => testData?.[required] || required !== "row" ) - function parseTestJSON(e) { + async function parseTestJSON(e) { let jsonUpdate try { @@ -105,7 +108,9 @@ } } - automationStore.actions.addTestDataToAutomation(jsonUpdate) + const updatedAuto = + automationStore.actions.addTestDataToAutomation(jsonUpdate) + await automationStore.actions.save(updatedAuto) } const testAutomation = async () => { @@ -150,10 +155,14 @@ {#if selectedValues}
{ + const { testData: updatedTestData } = e.detail + testData = updatedTestData + }} />
{/if} @@ -162,7 +171,7 @@