Fix field type not updating when enum name is changed (#193 part2)

This commit is contained in:
1ilit
2024-07-31 19:12:28 +03:00
parent 34d9045229
commit 844b24100e
3 changed files with 41 additions and 4 deletions

View File

@@ -308,6 +308,13 @@ export default function ControlPanel({
}
} else if (a.element === ObjectType.ENUM) {
updateEnum(a.id, a.undo);
if (a.updatedFields) {
if (a.undo.name) {
a.updatedFields.forEach((x) =>
updateField(x.tid, x.fid, { type: a.undo.name.toUpperCase() }),
);
}
}
}
setRedoStack((prev) => [...prev, a]);
} else if (a.action === Action.PAN) {
@@ -477,6 +484,13 @@ export default function ControlPanel({
}
} else if (a.element === ObjectType.ENUM) {
updateEnum(a.id, a.redo);
if (a.updatedFields) {
if (a.redo.name) {
a.updatedFields.forEach((x) =>
updateField(x.tid, x.fid, { type: a.redo.name.toUpperCase() }),
);
}
}
}
setUndoStack((prev) => [...prev, a]);
} else if (a.action === Action.PAN) {