You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given an anyOf or a oneOf composition schema with two options. First an object with one property of type string and second just a string value. When option 2 has a value (example "adsads") and the dropdown is changed to the option 1. The value is set to this:
I narrow it down to the result of the function schemaUtils.sanitizeDataForNewSchema(newOption, oldOption, formData) in line 122 of the MultiSchemaField.tsx file.
After that function is executed, newFormData takes that value and later on is used to update the field value in line 128. I'll update later if I'm able to find out more about this issue.
The text was updated successfully, but these errors were encountered:
Definitely something unusual happening here. Thanks for the report @lindolo25 ! If you can open a PR to fix this we would be happy to review and accept it.
* Fix: #3922 by addind a condition to the spread operator when creating the newFormData in sanitizeDataForNewSchema(
* Add test cases to cover the changes required for the fix.
* Added CHANGELOG description of the fix.
* Add heath-freenome recommendation.
Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
---------
Co-authored-by: Heath C <51679588+heath-freenome@users.noreply.github.com>
Prerequisites
What theme are you using?
bootstrap-4
Version
5.1.0
Current Behavior
Given an anyOf or a oneOf composition schema with two options. First an object with one property of type string and second just a string value. When option 2 has a value (example
"adsads"
) and the dropdown is changed to the option 1. The value is set to this:It continues to keep those added properties after a value is give to option 1 string property:
Even if the
"additionalProperties": false
is set the an error will not be presented.The scenario will work as expected if option 2 has another type of value, I tested number and boolean.
Expected Behavior
After switching to the Option 1, the value should be and empty object
{}
.Steps To Reproduce
Environment
Anything else?
I narrow it down to the result of the function
schemaUtils.sanitizeDataForNewSchema(newOption, oldOption, formData)
in line 122 of the MultiSchemaField.tsx file.react-jsonschema-form/packages/core/src/components/fields/MultiSchemaField.tsx
Line 122 in 42e138c
After that function is executed,
newFormData
takes that value and later on is used to update the field value in line 128. I'll update later if I'm able to find out more about this issue.The text was updated successfully, but these errors were encountered: