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
List of options in the user interface is not updated when the schema state is updated;
If initialFormData contains a oneOf list, that does not include the value from InitialFormData, this breaks that particular field, preventing any non-manual updates to it;
Expected Behavior
Expect options list to update when schema changes;
Expect Select component to be prefilled with option with corresponding value from options list;
I didn't succeed in tracking why first bug occurs (locally it disappeared for me at some point for some reason, but still relevant in attached sandbox) so I will elaborate on second one.
In SelectWidget file if enumOptionsIndexForValue didnt find current value in options list - it returns undefined and passes it into mui Select . Mui, in its turn, uses useControlled hook to choose if component should be controlled externally or internally. As undefined is passed as value, this field starts using internal state and, due to realization of useControlled, it doesnt accept external value, stucks in that position and spams warnings in console.
Possible solution is to pass emptyValue if selectedIndexes is undefinedhere.
E.g.:
@Intendanto This fix looks like a reasonable approach. Would you be willing to make a PR to fix this in both the @rjsf/mui and @rjsf/material-ui since the code is the same in both?
Also I think there a React issue in your sandbox, because if I push the Add Options button and select a, b, or c then the d choice shows up in the list.
@heath-freenome
React issue was pretty obvious - js nested objects deep links. Object.assing recreates only lvl 1 object, so using deep @ramda/clone on schema fixed it. Sandbox updated.
Yes, will create PR. I see I dont have rights to push the branch now.
@Intendanto you will need to fork the repo and do the change on your fork, then return to PR tab and you should be able to create a PR against this repo using your fork's branch
Prerequisites
What theme are you using?
mui
Version
5.11.1
Current Behavior
In general, codeandbox detects 2 errors:
initialFormData
contains aoneOf
list, that does not include the value from InitialFormData, this breaks that particular field, preventing any non-manual updates to it;Expected Behavior
Steps To Reproduce
sandbox
Environment
OS: Ubuntu 22.* Node: 18.15.0 yarn: 1.22.19
Anything else?
I didn't succeed in tracking why first bug occurs (locally it disappeared for me at some point for some reason, but still relevant in attached sandbox) so I will elaborate on second one.
In SelectWidget file if
enumOptionsIndexForValue
didnt find current value in options list - it returnsundefined
and passes it into mui Select . Mui, in its turn, uses useControlled hook to choose if component should be controlled externally or internally. Asundefined
is passed as value, this field starts using internal state and, due to realization ofuseControlled
, it doesnt accept external value, stucks in that position and spams warnings in console.Possible solution is to pass
emptyValue
ifselectedIndexes
isundefined
here.E.g.:
Please, review the issue, and if it is - if I should create PR
Btw, thanks for great libs :)
The text was updated successfully, but these errors were encountered: