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

Fix formRender removing a valid empty userData array #1515

Merged
merged 3 commits into from
Feb 9, 2024

Conversation

lucasnetau
Copy link
Collaborator

select.js controls (Radio, Checkbox, Select) support an empty userData array. This was being filtered out by sanitizeField when putting the field data through trimObj.

This PR:

  • fixes up the documentation for trimObj to document the removal of empty arrays
  • ensures an empty userData array is returned while allowing trimObj to remove other invalid datatypes
  • fixes a incorrect assignment when sanitising the value object
  • adds additional tests to validate this behaviour

Fixes #1514

Comment on lines +162 to +164
if (Array.isArray(field.userData) && field.userData.length === 0) {
sanitizedField.userData = [] //Special handler for allowing userData to be empty
}
Copy link
Owner

Choose a reason for hiding this comment

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

👍

@kevinchappell kevinchappell merged commit eff6949 into kevinchappell:master Feb 9, 2024
1 check passed
Copy link

github-actions bot commented Feb 9, 2024

🎉 This PR is included in version 3.19.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

checkbox is auto seleced when dragged and dropped, should be deselected initially when dragged and dropped
2 participants