Skip to content

Conversation

brendanbond
Copy link
Contributor

@brendanbond brendanbond commented Aug 22, 2024

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:

  • I have completed the above PR template
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (if applicable)
  • My changes generate no new warnings
  • My changes include tests that prove my fix is effective (or that my feature works as intended)
  • New and existing unit/integration tests pass locally with my changes
  • Any dependent changes have corresponding PRs that are listed above

@brendanbond brendanbond changed the title FIO-8886: use strict equality check for conditional component paths rather than Array.prototype.includes FIO-8885 & FIO-8886: use strict equality check for conditional component paths rather than Array.prototype.includes Aug 22, 2024
Copy link
Contributor

@mikekotikov mikekotikov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants