4Science / dspace-angular

Angular UI for DSpace and DSpace-CRIS. In the dspace-cris-7 branch you can find the extension to support DSpace-CRIS
BSD 3-Clause "New" or "Revised" License
14 stars 28 forks source link

Auto-save in new Item Submission form breaks the form #4

Closed alemarte closed 3 years ago

alemarte commented 3 years ago

References

Major issue related to this PR is #835 Other involved issues are: #948 #864 #884 #882 #931

Before describing the approach adopted in this PR, it is useful to summarise the problems that it directly or indirectly tries to address. Having investigated them for a long time, it has been possible to trace the root causes of these problems.

At this moment all the above problems except (5), (6) and (3) (which is a side effect) are mitigated by the redraw which is extremely frequent. The more you reduce the frequency of redraw, the more these problems arise.

But it is clear that redraw in turn causes many side effects and ideally should be avoided as much as possible.

Current workaround to all this mess

Moreover: We tried to save the focused state of the section in order to postpone the form redraw which causes the emptying of populated fields and the loss of the focus field (6). The result is that sometimes the redraw is not evoked at all as the user goes from one field to another without ever leaving the form. So we decided to revert (but still in commit history).

It doesn't solve in any way (1) whose fix, as already stated, is expensive to implement and unmaintainable.

Ideal solution: remove the template row from the repeatable field control Removing the template row from the repeatable fields immediately fix (1), (2), (3). The added submission's metadata into the store reduces the redraw so that the user experience is fluid most of the time. The redraw remains in case of interaction with lookups. Moreover Implementing the lookup so that it directly patches the form could be more than welcome. Leave the redraw as the only strategy in case the server actually enriches the form with additional data. In that case a notification will be displayed to the user and it would probably be acceptable to lose the information about the touched fields and have a solution more clean and mantainable.

Checklist