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

Nested form willReceiveNewProps calls the cleanUp function, resetting the LocalState #68

Open
gabriel-dehan opened this issue Apr 2, 2016 · 0 comments

Comments

@gabriel-dehan
Copy link

Hello there,

Not sure about the title, the problem is quite specific ~

Issue probably related to #2.
I have this setup with a modal component and inside it a form component. When I click the modal button, the underlying form is submitted through a props change + a willReceiveNewProps in the form.

From what I understand :
When I click the modal button, it sends a new prop (didSubmit) to my form component which is handled in willReceiveNewProps which calls the action. In the action I set the errors in the LocalState which also calls willReceiveNewProps, which means the cleanUp function is called, reseting the LocalState and removing the error immediately. Or something like that.

Form Submit -> Modal didSubmit -> Form willReceiveNewProps (didSubmit == true) -> Form submit is called which calls the action -> action changes LocalState -> cleanUp is called because new prop -> LocalState.get('FORM_ERROR') is null.

I have the code here : https://github.com/LoLImprove/Rise/tree/v2/client/modules/replays
NewReplay is the modal component and ReplayForm is the form component.

I guess I am missing something or I am doing the form handling the wrong way ? How should I be handling this ?

Thanks a lot !

@gabriel-dehan gabriel-dehan changed the title Nested form willReceiveNewProps calls the cleanUp function, reseting the LocalState Nested form willReceiveNewProps calls the cleanUp function, resetting the LocalState Apr 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant