diff --git a/packages/builder/src/builderStore/store/automation/index.js b/packages/builder/src/builderStore/store/automation/index.js index dd28d14461..66715faf3a 100644 --- a/packages/builder/src/builderStore/store/automation/index.js +++ b/packages/builder/src/builderStore/store/automation/index.js @@ -229,7 +229,7 @@ const automationActions = store => ({ } newAutomation.definition.stepNames = { ...newAutomation.definition.stepNames, - [stepId]: name, + [stepId]: name.trim(), } await store.actions.save(newAutomation) diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte index 784cdf2357..d45fe96ad7 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte @@ -15,7 +15,6 @@ let testDataModal let confirmDeleteDialog let scrolling = false - let hasScrolled = false $: blocks = getBlocks(automation) const getBlocks = automation => { @@ -36,13 +35,11 @@ } const handleScroll = e => { - if (e.target.scrollTop >= 30 && !hasScrolled) { + if (e.target.scrollTop >= 30) { scrolling = true - hasScrolled = true - } else if (e.target.scrollTop < 30 && hasScrolled) { + } else if (e.target.scrollTop) { // Set scrolling back to false if scrolled back to less than 100px scrolling = false - hasScrolled = false } } diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItemHeader.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItemHeader.svelte index 8b907ae0f6..868e6eb1bd 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItemHeader.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItemHeader.svelte @@ -31,7 +31,7 @@ )?.[0] } } - $: loopBlock = $selectedAutomation?.definition.steps.find( + $: loopBlock = $selectedAutomation.definition.steps.find( x => x.blockToLoop === block?.id ) @@ -57,12 +57,10 @@ } const getAutomationNameError = name => { - if (name !== block.name && block.name.includes(name)) { - if (name?.length > 0) { - let invalidRoleName = !validRegex.test(name) - if (invalidRoleName) { - return "Please enter a role name consisting of only alphanumeric symbols and underscores" - } + if (name !== block.name && name?.length > 0) { + let invalidRoleName = !validRegex.test(name) + if (invalidRoleName) { + return "Please enter a role name consisting of only alphanumeric symbols and underscores" } return null } @@ -73,14 +71,14 @@ } const saveName = async () => { - if (automationNameError) { + if (automationNameError || block.name === automationName) { return } if (automationName.length === 0) { - automationStore.actions.deleteAutomationName(block.id) + await automationStore.actions.deleteAutomationName(block.id) } else { - automationStore.actions.saveAutomationName(block.id, automationName) + await automationStore.actions.saveAutomationName(block.id, automationName) } } @@ -114,7 +112,9 @@ {#if isTrigger}
Trigger {:else} - Step {idx} +