From b902e017dd3b7fbc57befac08a2b011021ef95c7 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Thu, 18 Nov 2021 11:41:51 +0000 Subject: [PATCH] fix bug with test results --- .../builder/src/builderStore/store/automation/index.js | 4 +++- .../automation/AutomationBuilder/FlowChart/FlowItem.svelte | 7 +++---- .../automation/AutomationPanel/AutomationList.svelte | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/builderStore/store/automation/index.js b/packages/builder/src/builderStore/store/automation/index.js index 50a1f476ef..7bd0ccca22 100644 --- a/packages/builder/src/builderStore/store/automation/index.js +++ b/packages/builder/src/builderStore/store/automation/index.js @@ -87,13 +87,15 @@ const automationActions = store => ({ const response = await api.post(`/api/automations/${_id}/test`, testData) const json = await response.json() store.update(state => { - state.selectedAutomation.automation.testResults = json + state.selectedAutomation.testResults = json return state }) }, select: automation => { store.update(state => { + let testResults = state.selectedAutomation?.testResults state.selectedAutomation = new Automation(cloneDeep(automation)) + state.selectedAutomation.testResults = testResults state.selectedBlock = null 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 5ce55437be..ba80e195ab 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte @@ -25,11 +25,10 @@ let resultsModal let setupToggled let blockComplete - $: testResult = - $automationStore.selectedAutomation.automation.testResults?.steps.filter( - step => step.stepId === block.stepId - ) + $: testResult = $automationStore.selectedAutomation.testResults?.steps.filter( + step => step.stepId === block.stepId + ) $: isTrigger = block.type === "TRIGGER" $: selected = $automationStore.selectedBlock?.id === block.id diff --git a/packages/builder/src/components/automation/AutomationPanel/AutomationList.svelte b/packages/builder/src/components/automation/AutomationPanel/AutomationList.svelte index 79de4bfbe6..aa3ab027a8 100644 --- a/packages/builder/src/components/automation/AutomationPanel/AutomationList.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/AutomationList.svelte @@ -9,6 +9,7 @@ onMount(() => { automationStore.actions.fetch() }) + function selectAutomation(automation) { automationStore.actions.select(automation) $goto(`./${automation._id}`)