fix, handling use case when duplicate step name is allowed

This commit is contained in:
Naveen Kumar 2024-12-24 13:29:06 +05:30
parent 063ed62c3d
commit 4339bf1d3c
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