react-jsonschema-form
react-jsonschema-form copied to clipboard
Initial values don't set for array -> items -> oneOf -> oneOf schemaStructure
Prerequisites
- [X] I have searched the existing issues
- [X] I understand that providing a SSCCE example is tremendously useful to the maintainers.
- [X] I have read the documentation
- [X] Ideally, I'm providing a sample JSFiddle or a shared playground link demonstrating the issue.
What theme are you using?
core
Version
4.1.1
Current Behavior
When form is loaded it's empty, though there is formData
provided.
https://rjsf-team.github.io/react-jsonschema-form/#eyJmb3JtRGF0YSI6W3siaXBzdW0iOnsibmlnaHQiOiJuaWNodCJ9fV0sInNjaGVtYSI6eyJ0eXBlIjoiYXJyYXkiLCJpdGVtcyI6eyJvbmVPZiI6W3sicHJvcGVydGllcyI6eyJsb3JlbSI6eyJ0eXBlIjoic3RyaW5nIn19LCJyZXF1aXJlZCI6WyJsb3JlbSJdfSx7InByb3BlcnRpZXMiOnsiaXBzdW0iOnsib25lT2YiOlt7InByb3BlcnRpZXMiOnsiZGF5Ijp7InR5cGUiOiJzdHJpbmcifX19LHsicHJvcGVydGllcyI6eyJuaWdodCI6eyJ0eXBlIjoic3RyaW5nIn19fV19fSwicmVxdWlyZWQiOlsiaXBzdW0iXX1dfX0sInVpU2NoZW1hIjp7fSwidGhlbWUiOiJkZWZhdWx0IiwibGl2ZVNldHRpbmdzIjp7InZhbGlkYXRlIjpmYWxzZSwiZGlzYWJsZSI6ZmFsc2UsInJlYWRvbmx5IjpmYWxzZSwib21pdEV4dHJhRGF0YSI6ZmFsc2UsImxpdmVPbWl0IjpmYWxzZX19
Expected Behavior
Form values should match formData
Here's a example with initial data from docs, form is filled with initial formData
:
https://rjsf-team.github.io/react-jsonschema-form/#eyJmb3JtRGF0YSI6eyJmaXJzdE5hbWUiOiJDaHVja2xlIiwibGFzdE5hbWUiOiJOb3JyaWxzayIsImFnZSI6NzUsImJpbyI6IlJvdW5kaG91c2Uga2lja2luZyBhc3NlcyBzaW5jZSAxOTQwIiwicGFzc3dvcmQiOiJub25lZWQifSwic2NoZW1hIjp7In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yJ2YWxpZGF0ZSI6ZmFsc2UsImRpc2FibGUiOmZhbHNlLCJyZWFkb25seSI6ZmFsc2UsIm9taXRFeHRyYURhdGEiOmZhbHNlLCJsaXZlT21pdCI6ZmFsc2V9fQ==
Steps To Reproduce
When updating formData
(typing smth in input or updating manually in right bottom window) its shape doesn't change and form fills with corresponding values.
Environment
No response
Anything else?
Occurs when the schemaStructure is array > items > oneOf > oneOf
@v1valasvegan this looks like its fixed in the latest v5 beta? If I click your link above and select option 2. its filled with the data
@v1valasvegan this looks like its fixed in the latest v5 beta? If I click your link above and select option 2. its filled with the data
It should be selected when the page is loaded. If you visit second link you'll notice that formData
matches data you see it form inputs.

@epicfaace im not sure about the second comment. Does oneOf automatically select the option based on initial formData?
Does oneOf automatically select the option based on initial formData?
oneOf should do so.
This is definitely a bug with the oneOf selection. I have a fix in my local build that I think will solve this. I guess it is time to port it