Skip to content

Commit e8c51e5

Browse files
sara-gnucooprobzan8
authored andcommitted
fix(core/models): FROM_REPS: remove null values
1 parent 4412688 commit e8c51e5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

projects/core/models/src/utils/expression-utils.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ export interface MainForm {
4141
reps?: Instances;
4242
}
4343

44+
/**
45+
* Return all repeating slides in a form
46+
* @param form
47+
* @returns
48+
*/
4449
function allReps(form: MainForm): Form[] {
4550
if (form.reps == null) {
4651
return [];
@@ -2085,7 +2090,8 @@ export function FROM_REPS(forms: MainForm | MainForm[], expression: Func | strin
20852090
forms = [forms];
20862091
}
20872092
const func = expression;
2088-
return forms.map(form => allReps(form || {}).map(rep => func({...form, ...rep}))).flat();
2093+
const res = forms.map(form => allReps(form || {}).map(rep => func({...form, ...rep}))).flat();
2094+
return res.filter(val => val != null);
20892095
}
20902096

20912097
/**

0 commit comments

Comments
 (0)