Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#3678, #3217 - Fix ordering and changing values of repeatable inputs in submission form #3679

Merged
merged 1 commit into from
Dec 19, 2024

Conversation

AndreaBarbasso
Copy link
Contributor

@AndreaBarbasso AndreaBarbasso commented Nov 21, 2024

References

Description

Wrapped the control.get method call in order to maintain a consistent link between Models and Controls.

Instructions for Reviewers

Please, try to reproduce the bug described in #3678 following the same steps included in that issue.
Here is a video showcasing the bugfix.

reordering-fixed.mp4

List of changes in this PR:

  • Wrapped the control.get method in a custom method that adds the startingIndex property to the groupModel and uses that value as the key to get the relative control. Since controls are never updated, but elements change their index when they are being reordered, this fixes issues regarding value changes and consequential reordering of items.
  • Set up the formGroupName as the index stored in the groupModel object. This way we can avoid using the ngFor index, since the groupModel.index property is being updated after reordering items.

Checklist

  • My PR is created against the main branch of code (unless it is a backport or is fixing an issue specific to an older branch).
  • 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.
  • My PR passes ESLint validation using npm run lint
  • My PR doesn't introduce circular dependencies (verified via npm run check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide. Tests are not available for the DynamicFormArray component.
  • My PR aligns with Accessibility guidelines if it makes changes to the user interface.
  • My PR uses i18n (internationalization) keys instead of hardcoded English text, to allow for translations.
  • My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.
  • 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.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

@AndreaBarbasso AndreaBarbasso marked this pull request as ready for review November 21, 2024 11:07
@tdonohue tdonohue added bug component: submission 1 APPROVAL pull request only requires a single approval to merge claimed: 4Science 4Science team is working on this issue & will contribute back port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release labels Nov 21, 2024
@tdonohue
Copy link
Member

@kshepherd : this PR claims to fix #3217, which it looks like was assigned to you (and you may have been working on?). Would you be interested in reviewing/testing this, since you've been looking into the same issue. (Perhaps there's a way to merge your work into this work, if we need to do so)

@jlipka
Copy link

jlipka commented Nov 25, 2024

Outside of the official review/approval process, I have also tested this behaviour and it looks good to me, although I have not been able to reproduce the behaviour described in #3217, but #3678 has been repeatedly reproducible and seems to be fixed with these code changes.


UPDATE:
Although the suitable error seems to have been fixed, I think I saw a new bug in the submission while playing around. In the video you can see the click sequence - can you reproduce this and also attribute it to the change?

Even if I recorded the "authors" form fields to show the console error, the same behaviour is reproducable for the "Type" field which was used in other screen recordings. Just add some items, re-order and remove them again.

pr-3679-submission-form-bug-720p.mov

Copy link
Member

@kshepherd kshepherd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 this looks good and I prefer it to my fix (which may still be worthy of merging anyway if that sub is never needed)
Note, to fully get re-ordering a mix of plain values and relationships for e.g. Author, I also had to have the following PR applied: DSpace/DSpace#9744 (already merged to main and 8.x but not in 8.0) - it fixes an important left-right relationship comparison test.

@tdonohue tdonohue added this to the 9.0 milestone Dec 19, 2024
@tdonohue tdonohue merged commit 6ac9229 into DSpace:main Dec 19, 2024
13 checks passed
@dspace-bot
Copy link
Contributor

@dspace-bot
Copy link
Contributor

@tdonohue tdonohue removed port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release labels Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 APPROVAL pull request only requires a single approval to merge bug claimed: 4Science 4Science team is working on this issue & will contribute back component: submission
Projects
Status: ✅ Done
5 participants