mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
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:
co-authored by
Claude Opus 4.6
parent
c939f8a76e
commit
aa0101c666
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user