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-8731: Update fix to nested hidden components #128

Merged
merged 2 commits into from
Aug 5, 2024
Merged

Conversation

brendanbond
Copy link
Contributor

@brendanbond brendanbond commented Aug 4, 2024

Link to Jira Ticket

https://formio.atlassian.net/browse/FIO-8731

Description

This commit:

  • reverts adding layout component logical branch to eachComponentData
  • reverts the isParent check in validation subroutine
  • adds a hiddenChildren processor to core that adds hidden properties to children

This is not the most ideal solution for two reasons:

(a) it continues ad-hoc iteration over the components tree, which has the potential to be a bottleneck in situations where there are many levels of nested hidden components (there is no mechanism to avoid repeating the hiddenChildren processor). It would better to eliminate this ad-hoc iteration entirely to go with some approach that allowed processors to pass values down to child nested components. (Note that we were already doing this, this PR just codifies it into its own processor.)

(b) Although less of a concern, I can imagine a scenario in which some logic in some deeply nested component actually un-hides the child components, in which case you could potentially run into a scenario where the grand parent component is hidden but one or more children are un-hidden.

However, this issue is blocking a major release, so I propose that we merge this change and file a tech-debt ticket to resolve this issue in a better way.

Breaking Changes / Backwards Compatibility

n/a

Dependencies

n/a

How has this PR been tested?

Automated tests added for the previous solution for this ticket pass, as well as upstream OSS formio 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

* reverts adding layout component logical branch to eachComponentData
* reverts the isParent check in validation subroutine
* adds a hiddenChildren processor to core that adds hidden properties to children
});
}
} else if (component.hidden) {
const info = componentInfo(component);
Copy link
Contributor

Choose a reason for hiding this comment

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

@brendanbond Please explain why we need to do this. As I know we use conditionals scope to pass an array of components to clearHidded processor to unset them. Then why do we need to set hidden property on components itself?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because this covers the case of a component being manually hidden (rather than conditionally hidden) via the component json

src/process/hiddenChildren.ts Outdated Show resolved Hide resolved
@lane-formio lane-formio merged commit dbd8da3 into master Aug 5, 2024
6 checks passed
lane-formio added a commit that referenced this pull request Oct 4, 2024
FIO-8731: Update fix to nested hidden components
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