Skip to content

Commit feabece

Browse files
committed
LIBDRUM-909. Force re-display of validation errors
These changes are an attempt to fix an apparent race condition between the Angular field validation and the DSpace refresh of the page on attempted submission. The issue being fixed is that the GUI validation error warnings momentarily "flash" and then disappear when submitting the form using the "Deposit" button. The workflow appears to be: * The user does not focus on or enter anything in a required field, and then attempts to submit the form. * The request to the DSpace backend does not include any JSON related to the required field * A 200 response is returned from the DSpace backend, with an "errors" array in the JSON, indicating the validation error * The 200 response triggers a page refresh, which wipes out any existing validation error display on the page. This change forces all the validation errors to be re-displayed by touching the relevant fields and triggering a validity check after the page is refreshed. It is unclear whether this is the optimal fix, so it has not been submitted upstream to DSpace. Also, DSpace has been working on various fixes, so the changes in this class should be re-evaluated on upgrades, and removed if possible. https://umd-dit.atlassian.net/browse/LIBDRUM-909
1 parent 5388c7b commit feabece

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/app/submission/sections/form/section-form.component.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,14 @@ export class SubmissionSectionFormComponent extends SectionModelComponent {
395395
.subscribe(() => {
396396
this.sectionService.checkSectionErrors(this.submissionId, this.sectionData.id, this.formId, errors, this.sectionData.errorsToShow);
397397
this.sectionData.errorsToShow = errors;
398+
399+
// UMD Customization
400+
// Ensure that any validation errors are marked
401+
if (isNotEmpty(errors) && this.formRef?.formGroup) {
402+
this.formService.validateAllFormFields(this.formRef.formGroup);
403+
}
398404
this.cdr.detectChanges();
405+
// End UMD Customzation
399406
});
400407
}
401408

0 commit comments

Comments
 (0)