FIO-9312: fixed an issue where conditionals does not work well when there are several components with the same key/path #5898
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-9312
Description
What changed?
The simple conditionals always refer to the component path relative to the root form.
If a form top level component (A) and a component (B) inside the container (C) have the same key, the top level of the data object and the row object for the component (D) inside container C will have the same property.
E.g. component (A) path - 'test', (C) path - 'container', (B) path - 'container.test', (D) path - 'container.dComponent'.
The data object for D will look like that:
{
test: 'value'
container: { test: 'value', dComponent: 'value' }
}
The row object for D will look like this:
{ test: 'value', dComponent: 'value' }
Both objects have the 'test' property on the top level.
Before, if the component D condition depended on the component A value (top level component with 'test' key), component D became visible also when the component B had the expected value. That happened because the row data was evaluated first.
This PR made the data object to be evaluated before the row data. This also fixes issues for the conditional components inside editGrid/dataGrid and provides compatibility with server conditions check.
How has this PR been tested?
Manually + tests
Checklist: