dspace-angular
dspace-angular copied to clipboard
Fix for not all CREATE/DELETE Relationship requests coming through, during submission entity lookup
Description
The entity lookup modal used during submission has options to create/remove multiple relationships at a time. Currently however, REST is sometimes overwhelmed by getting too many of these requests at once, and some relationship creations/deletions might not come through.
This PR ensures that the requests are sent synchronously. This makes it so REST only receives them one at the time, and can process them one by one.
Ideally, these type of issues can be avoid all together with the proposed submission refactor ( #858 ).
Instructions for Reviewers
List of changes
- Removed the "Select/Deselect all" options from the dropdown in the DynamicLookupRelationSearchTab template, as well as the select button next to the dropdown.
- Until #858 is resolved, the load would be too high anyways.
- Users can still choose a larger page size, choose "Select page", and create a large amount of relationships that way.
- Added a
requestQueueto RelationshipEffects. - The constructor starts the
executeRequestsInQueue()method, which listens to the queue and calls eitheraddRelationship()orremoveRelationship(). It'll only start with the next request, after the previous one has completed. - Added a
RelationOperationTypeenum andRelationOperationinterface. This is how the queue gets its relationship info and knows what to include in the request. - Instead of calling
addRelationship()orremoveRelationship()directly, the effect just adds Operations to the queue.
How to test
- Make sure entities are enabled.
- Make sure you already have multiple, local Person entities.
- Start a submission in a collection which has the
submission-process"Publication" configured. - Open the author lookup modal (and the Network tab in DevTools).
- On the tab "Local Authors", when clicking "Select page", verify the POST request are being sent one by one, and don't overlap.
- On the tab "Local Authors", when clicking "Deselect page", verify the DELETE request are being sent one by one, and don't overlap.
Checklist
- [x] My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
- [x] My PR passes ESLint validation using
yarn lint - [x] My PR doesn't introduce circular dependencies (verified via
yarn check-circ-deps) - [x] My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
- [x] My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
- [x] If my PR includes new libraries/dependencies (in
package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation. - [x] If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
- [x] If my PR fixes an issue ticket, I've linked them together.
@nona-luypaert : Apologies for the delay in getting to this PR. Would it be possible to also create a port of this PR for the main branch? That'd make it easier for me to test this also on 8.x to ensure it works for both 7.x & 8.x.
Hi @tdonohue , I opened following PR for main: #3040