Skip to content

FIO-10099: fix an issue where conditionally hidden layout components that are children of containers can wreak havoc#250

Closed
brendanbond wants to merge 2 commits intomasterfrom
FIO-10099
Closed

FIO-10099: fix an issue where conditionally hidden layout components that are children of containers can wreak havoc#250
brendanbond wants to merge 2 commits intomasterfrom
FIO-10099

Conversation

@brendanbond
Copy link
Copy Markdown
Contributor

Link to Jira Ticket

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

Description

If you have a layout component as a child to a container, and that layout component contains a conditional, at some point we will ask for its path, expecting something like container.panel. Instead, because layout components don't really have a data path (instead they have absolute paths), we will get container, flagging the entire container as conditionally hidden and potentially clearing the whole thing (assuming clearOnHide is enabled). This hotfix solution addresses this by checking the component's model type - if it is none, we will use the absolute path for the component when evaluating its conditional. This PR also ensures that paths are passed to the async version of eachComponentData under certain conditions.

I do think this reveals a weakness in our treatment of conditionals - we use the "scope" object here and there to check to see if a component somewhere else has been flagged as conditionally hidden. This is brittle, and we already have an alternative mechanism by which to do so: when we determine that a component is conditionally hidden, we use its ephemeral scope property (not to be confused with the scope process results object) to label it as such. A longer term solution here would be to use that property exclusively and to no longer rely on the scope for checks of this nature.

Breaking Changes / Backwards Compatibility

n/a

Dependencies

n/a

How has this PR been tested?

Automated test

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-10099: fix an issue where conditionally hidden layout components can wreak havoc FIO-10099: fix an issue where conditionally hidden layout components that are children of containers can wreak havoc May 1, 2025
@travist travist self-requested a review May 5, 2025 14:17
Copy link
Copy Markdown
Member

@travist travist left a comment

Choose a reason for hiding this comment

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

👍

@brendanbond
Copy link
Copy Markdown
Contributor Author

Closing this in favor of #243

@brendanbond brendanbond closed this May 5, 2025
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