[835] Auto-save in new Item Submission form breaks the form

Tests fixed.
This commit is contained in:
Alessandro Martelli
2020-11-20 17:25:20 +01:00
parent 875a43a14e
commit 999993734f
7 changed files with 48 additions and 22 deletions

View File

@@ -410,9 +410,8 @@ export class SubmissionObjectEffects {
this.submissionService.notifyNewSection(submissionId, sectionId, currentState.sections[sectionId].sectionType);
}
const sectionForm = forms[currentState.sections[sectionId].formId];
const sectionForm = getForm(forms, currentState, sectionId);
const filteredErrors = filterErrors(sectionForm, sectionErrors, currentState.sections[sectionId].sectionType, notify);
mappedActions.push(new UpdateSectionDataAction(submissionId, sectionId, sectionData, filteredErrors));
}
});
@@ -421,6 +420,15 @@ export class SubmissionObjectEffects {
}
}
function getForm(forms, currentState, sectionId) {
if (!forms) {
return null;
}
const formId = currentState.sections[sectionId].formId;
return forms[formId];
}
/**
* Filter sectionErrors accordingly to this rules:
* 1. if notifications are enabled return all errors