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

Properly cleanup select-like components values when options change at form runtime #817

Closed
Skaiir opened this issue Sep 24, 2023 · 2 comments
Assignees
Labels
bug Something isn't working spring cleaning Could be cleaned up one day

Comments

@Skaiir
Copy link
Contributor

Skaiir commented Sep 24, 2023

Describe the Bug

Currently, when the options of a field change at form runtime, but a value has already been set for them, the value is kept in the form state despite now not being valid anymore, see below.

grafik

This is particularly obvious with taglists which have a failsafe in place for when that happens, but occurs with every option consuming field.

Steps to Reproduce

  1. Create a checklist/taglist/select or radio component
  2. Create a checkbox with key isChecked
  3. Set the expression options for the first component to something like if isChecked then someArray else someOtherArray, both arrays should have no overlap in values
  4. Set a value on the first component
  5. Check the checkbox
  6. See the value is still present in the output data. In the case of taglist components this is very obvious.

Expected Behavior

  1. The value should be cleaned up, as we shouldn't allow a user to get in such an unsupported data state

If the value is not present in options, then the value is reset to null. Or on the case of multiselects, it should be filtered out and the state should be refreshed.

We should probably get rid of that failsafe as well, ideally by making it impossible for that failsafe state to be reached in the first place.

@Skaiir Skaiir added bug Something isn't working backlog Queued in backlog spring cleaning Could be cleaned up one day labels Sep 24, 2023
@Skaiir Skaiir self-assigned this Oct 11, 2023
Skaiir added a commit that referenced this issue Oct 11, 2023
@bpmn-io-tasks bpmn-io-tasks bot added in progress Currently worked on and removed backlog Queued in backlog labels Oct 11, 2023
@bpmn-io-tasks bpmn-io-tasks bot added needs review Review pending and removed in progress Currently worked on labels Oct 11, 2023
@marcosgvieira
Copy link

@Skaiir can you please check if there is any pending review for this one as it's on the "Needs Review" column? Thanks!

@Skaiir
Copy link
Contributor Author

Skaiir commented Nov 20, 2023

Hey, so this one is in review, I need to close it it's been sitting for a while. Adding it on my queue to handle this week.

#835

Skaiir added a commit that referenced this issue Nov 23, 2023
Skaiir added a commit that referenced this issue Nov 23, 2023
@bpmn-io-tasks bpmn-io-tasks bot removed the needs review Review pending label Nov 23, 2023
pull bot pushed a commit to nagyist/form-js that referenced this issue Nov 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working spring cleaning Could be cleaned up one day
Projects
None yet
Development

No branches or pull requests

3 participants