fix(ui): rename a step to a valid step id

This commit is contained in:
sam committed 2026-10-18 23:45:26 +11:00
1 parent 0adc26df62
commit b7f22948e5
1 file changed
+6 -1
+6 -1
View File
@@ -99,7 +99,12 @@ async function rename(): Promise<void> {
function commitRename(event: Event): void {
if (!renaming.value) return;
renaming.value = false;
const name = (event.target as HTMLInputElement).value.trim();
// A step id is a stable identifier that template references name, so a
// typed title becomes lowercase words joined by hyphens.
const name = (event.target as HTMLInputElement).value
.toLowerCase()
.replace(/[^a-z0-9]+/g, "-")
.replace(/^[^a-z]+|-+$/g, "");
if (name !== (props.data.name ?? "")) props.data.onRename?.(name);
}
</script>