forked from DSpace/dspace-angular
-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Labels
Description
Description of the bug
When users change a submission's collection, server-side validation errors are correctly received from the backend but fail to propagate to the UI components. This causes form sections to incorrectly display as valid (green checkbox) despite having underlying validation errors, leaving users without clear guidance on what needs to be fixed before submission.
Core Issue
The validation error propagation chain is broken during collection changes:
- Server returns validation errors in the response
- Errors are lost in the NgRx action dispatch flow
- UI components never receive error information
- Sections appear valid when they shouldn't be
To Reproduce
Quick Test Steps:
- Navigate to a submission form
- Fill out the form with intentionally invalid or incomplete data (e.g., missing required fields)
- Change the collection to a different option
- Observe the section validation indicators
- Expected: Sections with validation errors should show error indicators and display specific validation messages
- Actual: All sections show as valid (green checkbox) despite server returning validation errors
Detailed Test Case: Collection Change Error Propagation
Setup:
- Create or navigate to an existing submission
- Ensure the form has required fields that can trigger validation errors
- Have multiple collections available for selection
Test Steps:
- Initial State: Start with a submission in Collection A
- Trigger Errors: Leave required fields empty or enter invalid data
- Change Collection: Switch from Collection A to Collection B
- Check Server Response: Verify in browser DevTools Network tab that server returns validation errors in the response
- Check UI State: Observe that section validation indicators show green checkmarks (valid state)
- Attempt Save: Try to save or proceed to next section
- Expected Behavior: Sections should show validation errors immediately after collection change
- Actual Behavior: Sections appear valid despite server validation errors
Example from TU Wien's Case:
In the TU Wien Repositum project, this issue manifests when:
- Switching between different publication type collections (e.g., TU Wien Article → TU Wien Book, or TU Wien Conference Paper → TU Wien Book Contribution)
- Required metadata fields have different validation rules per collection type
- Server correctly identifies missing required fields for the new collection
- UI incorrectly shows all sections as valid, allowing users to proceed
- Only upon final submission do users discover the validation errors
Expected Results
- Server validation errors should propagate through the entire application flow
- Section validation indicators should accurately reflect error state after collection changes
- Users should see immediate feedback about validation issues
- Error messages should clearly indicate which fields need attention
- No silent data loss or validation state desynchronization
Technical Details
Components Affected
SubmissionFormComponentSubmissionServiceResetSubmissionFormAction(NgRx action)- Submission object effects and reducers
Files Involved
src/app/submission/form/submission-form.component.tssrc/app/submission/submission.service.tssrc/app/submission/objects/submission-objects.actions.tssrc/app/submission/objects/submission-objects.effects.tssrc/app/submission/objects/submission-objects.reducer.ts- Related test files
Root Cause
The onCollectionChange method in SubmissionFormComponent receives the full submission object from the server, including validation errors, but:
- Error Parsing Missing: The method doesn't extract or parse the
errorsobject from the submission response - Action Parameter Missing:
ResetSubmissionFormActionconstructor lacks anerrorsparameter - Service Method Incomplete:
resetSubmissionObjectinSubmissionServicedoesn't accept or pass through errors - State Update Broken: NgRx reducer doesn't receive errors to update section state
This breaks the error propagation chain: