From 8cd4fae50ca0e3d7aeb8458fe509f9bd755af5ed Mon Sep 17 00:00:00 2001 From: Dean Date: Thu, 28 Nov 2024 12:37:13 +0000 Subject: [PATCH 01/15] Refactored out test data bind, fix for row intialisation in test data and fix for the modal timing issue --- .../FlowChart/TestDataModal.svelte | 21 ++++++++++----- .../SetupPanel/AutomationBlockSetup.svelte | 26 ++++++++++--------- 2 files changed, 29 insertions(+), 18 deletions(-) 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 @@