Merge pull request #15234 from imnaveenk/automation-duplicate-name

fix, handling use case when duplicate step name is allowed
This commit is contained in:
Martin McKeaveney 2024-12-30 14:37:17 +00:00 committed by GitHub
commit 540aef8567
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -22,7 +22,7 @@
const dispatch = createEventDispatcher()
$: blockRefs = $selectedAutomation?.blockRefs || {}
$: stepNames = automation?.definition.stepNames
$: stepNames = automation?.definition.stepNames || {}
$: allSteps = automation?.definition.steps || []
$: automationName = itemName || stepNames?.[block.id] || block?.name || ""
$: automationNameError = getAutomationNameError(automationName)
@ -64,7 +64,7 @@
const getAutomationNameError = name => {
const duplicateError =
"This name already exists, please enter a unique name"
if (stepNames && editing) {
if (editing) {
for (const [key, value] of Object.entries(stepNames)) {
if (name !== block.name && name === value && key !== block.id) {
return duplicateError