From 208d5bb265887d7b91a8b40e1578637203fba128 Mon Sep 17 00:00:00 2001 From: Vlad Nouski Date: Tue, 28 Nov 2023 11:46:13 +0100 Subject: [PATCH] [DSC-1404] fix: invalid value for setValue --- src/app/shared/form/builder/form-builder.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/shared/form/builder/form-builder.service.ts b/src/app/shared/form/builder/form-builder.service.ts index fd7daeba33d..16d280a94db 100644 --- a/src/app/shared/form/builder/form-builder.service.ts +++ b/src/app/shared/form/builder/form-builder.service.ts @@ -653,9 +653,9 @@ export class FormBuilderService extends DynamicFormService { const newGroup = this.createFormGroup(groupModel.group, null, groupModel); const previousKey = Object.keys(previousGroup.getRawValue())[0]; const newKey = Object.keys(newGroup.getRawValue())[0]; - - if (!isObjectEmpty(previousGroup.getRawValue()[previousKey])) { - newGroup.get(newKey).setValue(previousGroup.getRawValue()[previousKey]); + const rawValue = previousGroup.getRawValue()[previousKey]; + if (!isObjectEmpty(rawValue)) { + newGroup.get(newKey).patchValue(rawValue); } formArray.insert(index, newGroup);