Fix for renaming steps. Removed unnecessary binding reprocessing

This commit is contained in:
Dean 2024-10-11 16:59:46 +01:00
parent 9382ca4c0b
commit 61188fcc70
1 changed files with 6 additions and 23 deletions

View File

@ -335,7 +335,6 @@ const automationActions = store => ({
} }
/* End special cases for generating custom schemas based on triggers */ /* End special cases for generating custom schemas based on triggers */
//let hasUserDefinedName = automation.stepNames?.[pathSteps[idx]?.id]
if (isLoopBlock) { if (isLoopBlock) {
runtimeName = `loop.${name}` runtimeName = `loop.${name}`
} else if (idx === 0) { } else if (idx === 0) {
@ -1037,30 +1036,14 @@ const automationActions = store => ({
return return
} }
const stepIndex = newAutomation.definition.steps.findIndex( const newName = name.trim()
step => step.id === blockId
)
if (stepIndex !== -1) { newAutomation.definition.stepNames = {
const oldName = newAutomation.definition.steps[stepIndex].name ...newAutomation.definition.stepNames,
const newName = name.trim() [blockId]: newName,
newAutomation.definition.stepNames = {
...newAutomation.definition.stepNames,
[blockId]: newName,
}
newAutomation.definition.steps[stepIndex].name = newName
newAutomation.definition.steps = updateBindingsInSteps(
newAutomation.definition.steps,
oldName,
newName,
stepIndex
)
await store.actions.save(newAutomation)
} }
await store.actions.save(newAutomation)
}, },
deleteAutomationName: async blockId => { deleteAutomationName: async blockId => {
const automation = get(selectedAutomation) const automation = get(selectedAutomation)