Limenius / liform-react

Generate forms from JSON Schema to use with React (& redux-form)
https://limenius.github.io/liform-react/
MIT License
174 stars 42 forks source link

Validation - using SubmissionError causing uncaught error #45

Closed jakub-zawislak closed 6 years ago

jakub-zawislak commented 6 years ago

There is something that should be mentioned in docs or changed in library. If you throw SubmissionError, that was imported in this way:

import { SubmissionError } from 'redux-form'

it causes exception, just like in this issue: https://github.com/erikras/redux-form/issues/2269 I think that causing exception because redux-form used by our app is different than redux-form from liform. Even if they are in the same versions. Example app from docs works, because it uses the same redux-form instance as liform.

This code works:

import { SubmissionError } from 'liform-react/node_modules/redux-form'
jakub-zawislak commented 6 years ago

I don't know why, but in my production server the npm installed liform-react properly i.e. it used redux-form already listed in the package.json instead of downloading second redux-form to the liform-react/node_modules/redux-form.

Now in dev environment I removed whole node_modules and installed packages again and it also works.

I'm using on both severs npm 4.2.0. I don't remember how my package.json looked like 3 weeks ago, but now it is:

"liform-react": "^0.9.0",
"redux-form": "^7.2.0",