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

File object becomes a basic js object #1233

Closed
oterral opened this issue Mar 26, 2019 · 3 comments · Fixed by #1234
Closed

File object becomes a basic js object #1233

oterral opened this issue Mar 26, 2019 · 3 comments · Fixed by #1234
Labels

Comments

@oterral
Copy link
Contributor

oterral commented Mar 26, 2019

Description

When we use the From component in a wrapper component and pass formData via props., the Form component transforms Props to State in componentWillReceiveProps . Problem is when we use a custom widget with an input file, the File object is transformed to a basic object in mergeObjects function because the File object is detected as an object.

I guess the solution is to exclude File from isObject function.

Do you think it's the way to go? I don't see any exception than File object which could be bad detected.

Steps to Reproduce

  1. Open https://codesandbox.io/s/n4mlxwq3ml
  2. Open the browser console
  3. Choose a file
  4. See in the console onChange event is triggered twice and the File object changes.

Expected behavior

The File object stays a File object

Actual behavior

The File object becomes a basic js object

Version

1.3.0

@epicfaace epicfaace added the bug label Mar 26, 2019
@epicfaace
Copy link
Member

@oterral , yes, that makes sense, you can just add a check to see if the input is an instance of File. I'd merge a PR that does this!

oterral added a commit to oterral/react-jsonschema-form that referenced this issue Mar 26, 2019
oterral added a commit to oterral/react-jsonschema-form that referenced this issue Mar 26, 2019
epicfaace pushed a commit that referenced this issue Mar 27, 2019
* Fix #1233 : Exclude File object from isObject detection

* Update test name

Co-Authored-By: oterral <oterral@users.noreply.github.com>
@oterral
Copy link
Contributor Author

oterral commented Mar 28, 2019

@epicfaace sorry to bother you with this. When is the next release planned ?

@epicfaace
Copy link
Member

@oterral Likely next week. For now, you could just do npm install -S git+https://github.com/mozilla-services/react-jsonschema-form.git#0f4889c22457edeb57991f48a88d8d32b2a93ca7 to get the changes from the latest commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants