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

Check for type of array in default #1300

Closed
3 tasks done
domharrington opened this issue May 29, 2019 · 5 comments
Closed
3 tasks done

Check for type of array in default #1300

domharrington opened this issue May 29, 2019 · 5 comments
Labels

Comments

@domharrington
Copy link
Contributor

Prerequisites

Description

When the default of an array type is null it causes an unrecoverable error:

https://mozilla-services.github.io/react-jsonschema-form/#eyJmb3JtRGF0YSI6e30sInNjaGVtYSI6eyJ0aXRsZSI6IkEgcmVnaXN0cmF0aW9uIGZvcm0iLCJkZXNjcmlwdGlvbiI6IkEgc2ltcGxlIGZvcm0gZXhhbXBsZS4iLCJ0eXBlIjoib2JqZWN0IiwicHJvcGVydGllcyI6eyJhcnJheSI6eyJ0eXBlIjoiYXJyYXkiLCJkZWZhdWx0IjpudWxsLCJpdGVtcyI6eyJ0eXBlIjoic3RyaW5nIn19fX0sInVpU2NoZW1hIjp7fX0=

Steps to Reproduce

  1. Go to playground link
  2. Check console

Expected behavior

Maybe disregard the default value if !Array.isArray(formData)?
https://github.com/mozilla-services/react-jsonschema-form/blob/cc7e1b4f29ef5d18eb2c595daa186131426e0d49/src/components/fields/ArrayField.js#L296

Actual behavior

Unrecoverable error

Version

Latest on playground.

@essonjon
Copy link

essonjon commented May 30, 2019

And there's a related issue, where a customer did not enter null as the default value but we automatically created it when converting their YAML file to JSON

@epicfaace epicfaace added the bug label Jun 3, 2019
@ghost
Copy link

ghost commented Jun 7, 2019

Is this related to #1238 ?

I'm currently also running into an issue where we define null as default value which causes a render issue.

@domharrington
Copy link
Contributor Author

domharrington commented Jun 7, 2019

I dont think it's related to that, this refers to when an array type has a default value of null which sounds like your issue.

@epicfaace
Copy link
Member

This issue might be fixed by #2154 but not sure -- need to check

@stale
Copy link

stale bot commented Oct 31, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please leave a comment if this is still an issue for you. Thank you.

@stale stale bot added the wontfix label Oct 31, 2022
@stale stale bot closed this as completed Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants