Describe the bug
(Copied directly from the detailed description in #960, as this issue was discovered in the work in #960)
From @alemarte:
Having investigated them for a long time, it has been possible to trace the root causes of these problems.
-
Problems caused by the template/zero row of repeatable fields
-
Problems caused by the repeatable field without form redrawing
-
Problems caused by the repeatable field with redraw
-
Problems caused by lookup functionality
- (4) The redraw of the form is mandatory.
The selected value is not added to the form, but a save submission is evoked. Once the data returns from the server, the form is redrawn.
-
Problems caused by form redraw
- (5) The history of the form is deleted, bypassing the native angular logic for displaying errors, which is typically very simple to implement by exploiting the touched and pristine fields of the controls.
- (6) In addition, fields edited but not saved (like during an autosave) are emptied.
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.
PR #960 works around several of these problems, namely (2) and (3) -- see that PR for more details
Also from @alemarte:
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 maintainable.
Describe the bug
(Copied directly from the detailed description in #960, as this issue was discovered in the work in #960)
From @alemarte:
PR #960 works around several of these problems, namely (2) and (3) -- see that PR for more details
Also from @alemarte: