fix(blocks): clarify condition ID suffix slicing for readability (#3546)

Use explicit hyphen separator instead of relying on slice offset to
implicitly include the hyphen in the suffix, making the intent clearer.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Waleed
2026-03-12 13:26:11 -07:00
committed by GitHub
co-authored by Claude Opus 4.6
parent c939f8a76e
commit aa0101c666
+4 -4
View File
@@ -19,8 +19,8 @@ export function remapConditionBlockIds(
const prefix = `${oldBlockId}-`
for (const condition of conditions) {
if (typeof condition.id === 'string' && condition.id.startsWith(prefix)) {
const suffix = condition.id.slice(oldBlockId.length)
condition.id = `${newBlockId}${suffix}`
const suffix = condition.id.slice(prefix.length)
condition.id = `${newBlockId}-${suffix}`
changed = true
}
}
@@ -49,8 +49,8 @@ export function remapConditionEdgeHandle(
const innerId = sourceHandle.slice(handlePrefix.length)
if (!innerId.startsWith(`${oldBlockId}-`)) continue
const suffix = innerId.slice(oldBlockId.length)
return `${handlePrefix}${newBlockId}${suffix}`
const suffix = innerId.slice(oldBlockId.length + 1)
return `${handlePrefix}${newBlockId}-${suffix}`
}
return sourceHandle