From 6793a6bdc7d715f3e06a7781f662864273c90f48 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Fri, 7 Feb 2025 21:50:11 +0100 Subject: [PATCH] fix: do not modify schema while iterating on it --- umap/static/umap/js/modules/form/builder.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/umap/static/umap/js/modules/form/builder.js b/umap/static/umap/js/modules/form/builder.js index ea78a10f..01fe8bb8 100644 --- a/umap/static/umap/js/modules/form/builder.js +++ b/umap/static/umap/js/modules/form/builder.js @@ -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) {