Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions docs/DrumAngularCustomizations.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,22 @@ would successfully complete:

* Commented out the "codecov" job, because UMD does not have an appropriate key
for uploading the results to codecov.io.

## Change to Submission Form Validation Handling

The "updateForm" method in the "SubmissionSectionFormComponent" class
(src/app/submission/sections/form/section-form.component.ts) has been
modified to clear the form validation errors held by Angular when
receiving a form update from the back-end.

This change is intended to fix an issue (see LIBDRUM-909) in which submitting
a form without all the required fields populated would only show a brief
"flash" of the validation errors, and then not show GUI validation
warnings on all affected fields. This is apparently caused by a race condition
between the Angular validation handling, and a page refresh triggered by the
DSpace backend response.

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 similar fixes, so
the changes in this class should be re-evaluated on upgrades, and
removed if possible.
14 changes: 14 additions & 0 deletions src/app/submission/sections/form/section-form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,20 @@ export class SubmissionSectionFormComponent extends SectionModelComponent {
this.isUpdating = true;
this.formModel = null;
this.cdr.detectChanges();
// UMD Customization
// Clear errors before calling initForm.
// This is needed because this code path may be called multiple times,
// and checksForErrors does a no-op (essentially clearing the
// validation errors) if the "this.sectionData.errorsToShow" hasn't
// changed.
// Clearing the "errorsToShow" ensures that checksForErrors actually
// shows the errors, no matter how many times this code block is called.
//
// Note: Future DSpace changes may eliminate the need for this change,
// so it should be checked when doing DSpace upgrades, and removed,
// if possible.
this.sectionData.errorsToShow = [];
// End UMD Customization
this.initForm(sectionData, errors, sectionState.serverValidationErrors);
this.checksForErrors(errors);
this.isUpdating = false;
Expand Down
Loading