From 4b6bc659dded438d1a37af99bc3d62f5c002327b Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Thu, 15 Apr 2021 15:49:09 +0200 Subject: [PATCH] Fix form module updater --- src/designer/elsa-workflows-studio/src/utils/forms.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/designer/elsa-workflows-studio/src/utils/forms.tsx b/src/designer/elsa-workflows-studio/src/utils/forms.tsx index 5f630e112..9f182605c 100644 --- a/src/designer/elsa-workflows-studio/src/utils/forms.tsx +++ b/src/designer/elsa-workflows-studio/src/utils/forms.tsx @@ -80,7 +80,8 @@ export function selectField(context: FormContext, fieldName: string, label: stri export function updateField(context: FormContext, fieldName: string, value: T) { const fieldNameHierarchy = fieldName.split('.'); - let current = {...context.model}; + let clone = {...context.model}; + let current = clone; for (const name of fieldNameHierarchy.slice(0, fieldNameHierarchy.length - 1)) { if (!current[name]) @@ -92,8 +93,8 @@ export function updateField(context: FormContext, fieldName: string, value: T const leafFieldName = fieldNameHierarchy.last(); current[leafFieldName] = value; - context.model = current; - context.updater(current); + context.model = clone; + context.updater(clone); } export function onTextInputChange(e: Event, context: FormContext) {