FIO-8885 & FIO-8886: use strict equality check for conditional component paths rather than Array.prototype.includes #141
+626
−120
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-8886
Description
Previously, we compared conditional component paths to the context path using
Array.prototype.includes
, which would trigger a false positive when the string path of the component was "contained" within another key (e.g. a key "or" would be found in another hidden key "information"). Since we should be adding components to the conditionals scope keyed by absolute paths, this PR changes the comparison to strict equality.Breaking Changes / Backwards Compatibility
n/a
Dependencies
n/a
How has this PR been tested?
The main concern here is ensuring that components added to the conditional scope are keyed by absolute data path, so I wrote tests trying to ensure that even deeply nested components get added to that scope using an absolute path. Additionally, formio and formio-server tests pass with this change.
Checklist: