Skip to content

Commit 0226ccb

Browse files
vNovskiatarix83
authored andcommitted
Merged in DSC-1404-can-not-duplicate-inline-group-when-mandatory-field-is-empty (pull request DSpace#1067)
[DSC-1404] fix: invalid value for setValue Approved-by: Giuseppe Digilio
2 parents 15ff078 + d3e9265 commit 0226ccb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/app/shared/form/builder/form-builder.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,9 +653,9 @@ export class FormBuilderService extends DynamicFormService {
653653
const newGroup = this.createFormGroup(groupModel.group, null, groupModel);
654654
const previousKey = Object.keys(previousGroup.getRawValue())[0];
655655
const newKey = Object.keys(newGroup.getRawValue())[0];
656-
657-
if (!isObjectEmpty(previousGroup.getRawValue()[previousKey])) {
658-
newGroup.get(newKey).setValue(previousGroup.getRawValue()[previousKey]);
656+
const rawValue = previousGroup.getRawValue()[previousKey];
657+
if (!isObjectEmpty(rawValue)) {
658+
newGroup.get(newKey).patchValue(rawValue);
659659
}
660660

661661
formArray.insert(index, newGroup);

0 commit comments

Comments
 (0)