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-9327 Fixed unintentional setting of defaultValue for Select Boxes #5925

Closed
wants to merge 2 commits into from

Conversation

antonSoftensity
Copy link
Contributor

@antonSoftensity antonSoftensity commented Nov 25, 2024

Link to Jira Ticket

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

Description

With the changes to the new Validation process, when new values were added to Select Boxes in the Component settings window, emptyValue was called for the Default Component, and the value was incorrect due to the old code that was used to just set Select Boxes options to false and make it an empty value. The fix was to set emptyValue to {} always, because it is a better representation of empty value which is never affected by the actual values of the component.

Breaking Changes / Backwards Compatibility

Use this section to describe any potentially breaking changes this PR introduces or any effects this PR might have on backwards compatibility

Dependencies

Use this section to list any dependent changes/PRs in other Form.io modules

How has this PR been tested?

Tested locally. Tests are passing for the SelectBoxes components. I've decided not to add new tests because the behavior is straightforward and we don't need to test that a component has specific emptyValue, when it is just an empty object all the time.

UPD: added 'selectBoxes' to an exception for a modalEdit test from basic component settings tests, due to the fact that the test for 'closing modal' was failing (during debugging it showed that everything was rendering correctly, just for some reason the handler for 'Close' button wasn't called, which is not connected with the change to 'emptyValue' function in my opinion, at least I couldn't find any evidence of that)

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

@antonSoftensity antonSoftensity force-pushed the FIO-9327-selectboxes-defaultvalue-fix branch from 8c17034 to 5f210b2 Compare November 27, 2024 15:25
@travist
Copy link
Member

travist commented Dec 2, 2024

I don't believe this is the correct fix for the problem. The issue is that the "defaultValue" is getting set and does not continually set to the correct value as you are editing the component values in the Builder mode. You are fixing this by just changing the default value of the Select Boxes component, which does not seem like it is fixing the root problem. I am going to investigate this today and will for now close this pr.

@travist travist closed this Dec 2, 2024
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