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

SubmissionError and validate seems to have different behaviour when raising errors for FieldArray #4734

Open
AndriyHromyak opened this issue May 25, 2021 · 1 comment
Labels

Comments

@AndriyHromyak
Copy link

AndriyHromyak commented May 25, 2021

Seems like SubmissionError and form validate prop have different behaviour.
I have used example here https://redux-form.com/8.3.0/examples/fieldarrays/ to generate dynamic FieldArray list. By dynamic i mean that there is ability to remove and add new fields.

Now i have two types of form validations, one from front(handled via "validate") and other from server(handled via "SubmissionError"). "validate" prop in reduxForm seems to work fine when we talk about throwing error to fields, by that i mean if we create f.e. 3-5 fields and f.e. third will have error(wrong email format, empty etc.) and we will remove this field error disappear, yet when do same thing with "SubmissionError" error stays just for next field which takes place deleted one. is it expected ?

Your environment

Software Version(s)
redux-form 8.3.6
redux 4.0.5
react-redux 7.2.0
react 16.13.1
react-dom 16.13.1
node 12

Steps to reproduce

To reproduce basically u need to add server validation to this example https://redux-form.com/8.3.0/examples/fieldarrays/ using SubmissionError, get error to some field in middle of added fields and delete field with error using fields.remove(index).

P.S. Also weird behaviour when using "fields.push({})" to add new field in to FieldArray.

Case 1: All fields got error(raised by reduxForm validate prop), when add new field triggering "push", all errors remains.
Case 2: All fields got error(raised by SubmissionError), when add new field triggering "push", all errors cleared.

Expected behaviour

field with error should be removed, and error not visible

Actual behaviour

field with error was removed, yet error was applied to field which took place of removed one.

@AndriyHromyak
Copy link
Author

Saw death note, that this lib is not maintained any more. Is there any guide to migrate to something what will be maintained for long time? If any one has hints what lib could be used to not worry about long term support please share ideas. Thx

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

1 participant