Availity / availity-reactstrap-validation

Easy to use React validation components compatible for reactstrap.
https://availity.github.io/availity-reactstrap-validation/
MIT License
191 stars 70 forks source link

Remove Submitted State #139

Closed GoPro16 closed 5 years ago

GoPro16 commented 5 years ago

Currently, when we submit anything in the AvForm the handleSubmit method will fire off all the validation methods. After all the prop functions are called the Form sets a submitted state that is used to display a className on the form wrapper. However, there is no class in our uikit that uses this and its not helpful since in some cases we redirect the user to a page and then get a warning about unmounting.

Code Link Where Unmounting Error Occurs

We have 2 Options:

1 - Store a var that will say when the component is unmounted, and then if it is unmounted prevent the state update to the AvForm

2 - Remove the submitted state logic as a whole.

GoPro16 commented 5 years ago

closed via #144

matheusb-comp commented 5 years ago

1 - Store a var that will say when the component is unmounted, and then if it is unmounted prevent the state update to the AvForm

I'm getting the state update warning like #98 and #101, but on version 2.6.0. The component using <AvForm> is mounted then immediately destroyed.

I placed logs before all calls to setState() in AvForm.js and got:

UserBox unmounting...
inside AvForm - setError
Warning: Can't perform a React state update on an unmounted component.

Seems to be in the setError() function.