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 a oneOf schema for which the possible types are object - when user selects a different subschema, properties unique to the old/previously selected subschema are not removed unless they were populated when user selected the new/current subschema. Therefore, if a user toggles/selects through each oneOf subschema, without populating unique properties props.formData will accumulate an invalid payload. However, if user populates unique properties before selecting different subschema, those properties are removed from formData when the new subschema is selected and form loaded.
This behavior is observable when props.formData is returned to Form component's onChange handler function. Properties unique to previously selected oneOf subschema(s) that were not populated are found in the formData, with values set to undefined. Upon form submission, errors will be thrown as the submitted object contains a conglomeration of properties not conforming to any of the oneOf subschemas.
This is very similar to the issue reported in 2183, however, with the v.5x refactor and implementation of sanitizeDataForNewSchema it seems somewhat different. Further, my proposed solution only resolves the issue in v5.x.
Expected Behavior
I expect properties unique to old/previously selected subschema to be removed, whether populated or not, from props.fomData when new/current subschema is selected, since they are irrelevant/out-of-scope when new subschema is selected.
It seems to me that properties unique to old/previously selected subschema should be discarded when the new/current subschema is selected; they should not be returned in the formData. But for some reason those properties are persisted and their values set to undefined, but maybe there's a reason?
The text was updated successfully, but these errors were encountered:
tmlstevens
changed the title
Prev. selected oneOf schema keys removed only IF populated
Prev. selected oneOf schema keys removed only IF populated when subschema changes
Feb 13, 2023
tmlstevens
changed the title
Prev. selected oneOf schema keys removed only IF populated when subschema changes
Prev. selected oneOf schema properties removed only IF populated when subschema changes
Feb 13, 2023
tmlstevens
changed the title
Prev. selected oneOf schema properties removed only IF populated when subschema changes
Prev. selected oneOf schema properties removed only IF populated when schema changes
Feb 13, 2023
Prerequisites
What theme are you using?
bootstrap-4
Version
5.x
Current Behavior
Given a oneOf schema for which the possible types are object - when user selects a different subschema, properties unique to the old/previously selected subschema are not removed unless they were populated when user selected the new/current subschema. Therefore, if a user toggles/selects through each oneOf subschema, without populating unique properties props.formData will accumulate an invalid payload. However, if user populates unique properties before selecting different subschema, those properties are removed from formData when the new subschema is selected and form loaded.
This behavior is observable when props.formData is returned to Form component's onChange handler function. Properties unique to previously selected oneOf subschema(s) that were not populated are found in the formData, with values set to undefined. Upon form submission, errors will be thrown as the submitted object contains a conglomeration of properties not conforming to any of the oneOf subschemas.
This is very similar to the issue reported in 2183, however, with the v.5x refactor and implementation of sanitizeDataForNewSchema it seems somewhat different. Further, my proposed solution only resolves the issue in v5.x.
Expected Behavior
I expect properties unique to old/previously selected subschema to be removed, whether populated or not, from props.fomData when new/current subschema is selected, since they are irrelevant/out-of-scope when new subschema is selected.
Steps To Reproduce
Environment
Anything else?
It seems to me that properties unique to old/previously selected subschema should be discarded when the new/current subschema is selected; they should not be returned in the formData. But for some reason those properties are persisted and their values set to undefined, but maybe there's a reason?
The text was updated successfully, but these errors were encountered: