Skip to content

Commit

Permalink
fixing bug with untyped properties on current value throwing errors w…
Browse files Browse the repository at this point in the history
…hen switching conditionTypes
  • Loading branch information
dvoegelin committed Aug 30, 2024
1 parent a9f17c8 commit 9baa213
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ export class ConditionGroupComponent implements OnInit, OnDestroy {
this.parentForm.controls[name] = this.parentForm.controls[this.controlName];
delete this.parentForm.controls[this.controlName];
this.controlName = name;
this.parentForm.get(this.controlName).setValue(current);
// scrub properties not on control
const currentStrict = current.map((item) => (({ conditionType, field, operator, scope, value, ...rest }) => ({ conditionType, field, operator, scope, value }))(item));
this.parentForm.get(this.controlName)?.setValue(currentStrict);
this.cdr.markForCheck();
}
}
Expand Down

0 comments on commit 9baa213

Please sign in to comment.