Skip to content

Commit

Permalink
Merged in DSC-1404-can-not-duplicate-inline-group-when-mandatory-fiel…
Browse files Browse the repository at this point in the history
…d-is-empty (pull request DSpace#1067)

[DSC-1404] fix: invalid value for setValue

Approved-by: Giuseppe Digilio
  • Loading branch information
vNovski authored and atarix83 committed Nov 30, 2023
2 parents 15ff078 + d3e9265 commit 0226ccb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/app/shared/form/builder/form-builder.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0226ccb

Please sign in to comment.