Dedupe patch operations by op and path#2778
Merged
alanorth merged 1 commit intoDSpace:mainfrom Feb 1, 2024
Merged
Conversation
3737eec to
f40639d
Compare
Contributor
Contributor
Author
Contributor
|
@WWelling thanks. This is +1 by testing from me. I managed to reproduce this (with network tab of developer tools open):
Inspect the request body of the PATCH and you see all four titles as separate [
{
"op":"replace",
"path":"/sections/traditionalpageone/dc.title/0",
"value":{
"value":"Title",
"language":null,
"authority":null,
"display":"Title",
"confidence":-1,
"place":0,
"otherInformation":null
}
},
{
"op":"replace",
"path":"/sections/traditionalpageone/dc.title/0",
"value":{
"value":"Title2",
"language":null,
"authority":null,
"display":"Title2",
"confidence":-1,
"place":0,
"otherInformation":null
}
},
{
"op":"replace",
"path":"/sections/traditionalpageone/dc.title/0",
"value":{
"value":"Title3",
"language":null,
"authority":null,
"display":"Title3",
"confidence":-1,
"place":0,
"otherInformation":null
}
},
{
"op":"replace",
"path":"/sections/traditionalpageone/dc.title/0",
"value":{
"value":"Title4",
"language":null,
"authority":null,
"display":"Title4",
"confidence":-1,
"place":0,
"otherInformation":null
}
}
]With this PR the PATCH after the test sequence is: [
{
"op":"replace",
"path":"/sections/traditionalpageone/dc.title/0",
"value":{
"value":"Title4",
"language":null,
"authority":null,
"display":"Title4",
"confidence":-1,
"place":0,
"otherInformation":null
}
}
] |
Contributor
Author
|
@alanorth thanks for the testing. |
alanorth
approved these changes
Feb 1, 2024
Contributor
|
Successfully created backport PR for |
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
References
Description
It was discovered that when many modifications of the submission form are done within a section, the PATCH request to update the section processes unnecessary patches on the back end. i.e. Change name, then title, then date multiple times, then name and title again. Only the last changes per input are necessary for the patch and the preceding by op and path are unnecessary to process on the backend.
Instructions for Reviewers
Determine the use case for providing the backend with all the UI form manipulations. If there is no valid use case, there is excessive processing done for each patch operation included that will nullify a previous patch.
List of changes in this PR:
To test concern:
Open inspector tools in the browser and watch the network traffic. During submission form change inputs repeatedly as if you either have a typo or inputted value in incorrect field or selected month and day of the date picker or changed your mind on an input. Then click save or click away from the submission section. There will be a PATCH request in the network traffic. Open the request body of the PATCH and there will be patch operations that are not the last changes and will not affect the JSON entity after PATCH.
Checklist
yarn lintyarn check-circ-deps)package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.