FIO-8185: Fixing issues with EditGrid and DataGrid clearOnHide with Conditionally visible elements. #77
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.
Link to Jira Ticket
https://formio.atlassian.net/browse/FIO-8185
Description
We had an issue where conditionally visible components inside of EditGrid and DataGrid were getting cleared when they were submitted with the conditions available. What caused this problem is that the method "getComponentActualValue" takes the "component path" and not the "data path" so instead of being "editGrid[1].textField" it would come in as "editGrid.textField". Since we cannot modify the "editGrid.textField" string since that is saved during the building process, we needed to convert that path to the "data path".
This can be done by examining the parent component path, removing all [0] and then trimming the rest. This would also work with components that have complex keys such as "foo.bar".
I also had to make a change to the Logic component since another part of the issue is that we were using the "component.hidden" flag to clear the data when hidden. The problem with this is that it is not reverse compatible since there are a lot of other hidden fields with this flag set that are able to set the data on the server. Because of this, I had to make a change to the Logic processor so that it would set the scope.conditionallyHidden array to add the component that was hidden due to Logic forcing the component hidden.
Breaking Changes / Backwards Compatibility
It should be reverse compatible.
Dependencies
None
How has this PR been tested?
Automated tests were written.
Checklist: