fix: do not modify schema while iterating on it

This commit is contained in:
Yohan Boniface 2025-02-07 21:50:11 +01:00
parent 815ff046ff
commit 6793a6bdc7

View file

@ -142,13 +142,14 @@ export class MutatingForm extends Form {
slugKey: 'PropertyInput',
labelKey: 'PropertyInput',
}
for (const [key, schema] of Object.entries(SCHEMA)) {
if (schema.type === Boolean) {
for (const [key, definition] of Object.entries(SCHEMA)) {
const schema = Utils.CopyJSON(definition)
if (definition.type === Boolean) {
if (schema.nullable) schema.handler = 'NullableChoices'
else schema.handler = 'Switch'
} else if (schema.type === 'Text') {
} else if (definition.type === 'Text') {
schema.handler = 'Textarea'
} else if (schema.type === Number) {
} else if (definition.type === Number) {
if (schema.step) schema.handler = 'Range'
else schema.handler = 'IntInput'
} else if (schema.choices) {