formio / core

The Form.io Core Javascript Framework
https://formio.github.io/core
MIT License
9 stars 6 forks source link

FIO-8723: Clear values from submission for hidden comp with clearOnHide flag #137

Closed mikekotikov closed 1 month ago

mikekotikov commented 2 months ago

Link to Jira Ticket

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

Description

What changed?

Added reset of component's 'hidden' property in conditionals and logic processors, for cases when array data components (like Edit Grid/Data Grid) with multiple rows were processed. The problem: the first time 'hidden' value got set in conditionals/logic processor, it was applied to component json and it was then thought to be present on every next row component, so the conditionals/logic wasn't recalculated for them.

Dependencies

None

How has this PR been tested?

Automated test was already there, but the assertion was incorrect, so fixed it

Checklist:

mikekotikov commented 1 month ago

I'm confused on how this fixes the problem that the ticket describes. It seems to me that the problematic example in FIO-8723 just has two components with default values; how do we get from there to row components such as edit grid or data grid?

Sorry, wrote not good description for the ticket. So, the original problem from the ticket is fixed by adding || component.hidden check in src/process/clearHidden.ts. And other stuff with deleting component.hidden was then added to fix the tests, since there was a wrong behavior for array data components, where in case of logic/conditions, the result of first row calculation was thought to be the same for all the next rows.

mikekotikov commented 1 month ago

@brendanbond refactored, removed all the places where component.hidden was mutated and my changes with deleting it

TanyaGashtold commented 1 month ago

This PR fixes one more issue related to conditional components inside EditGrid: https://formio.atlassian.net/browse/FIO-8992