Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIO-9312: fixed an issue where conditionals does not work well when there are several components with the same key/path #5898

Merged

Conversation

TanyaGashtold
Copy link
Contributor

@TanyaGashtold TanyaGashtold commented Nov 6, 2024

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:

  • 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

…here several component with the same key/path
@TanyaGashtold TanyaGashtold marked this pull request as draft November 6, 2024 09:21
@TanyaGashtold TanyaGashtold marked this pull request as ready for review November 6, 2024 19:06
@johnformio johnformio merged commit 1d6e607 into master Nov 7, 2024
5 checks passed
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.

2 participants