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

notifyOnSuccess should make the form un-dirty #46

Merged
merged 3 commits into from
Apr 10, 2019

Conversation

steinararnason
Copy link
Contributor

We have a use case at work where we need the form to not be dirty after using notifyOnSuccess so the save button on our form is disabled until the user edits some field again after submitting.

This PR adds that functionality 😁

Copy link
Member

@alex35mil alex35mil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for PR! It's a bit tricky change in terms of being implicitly breaking, kind of. I'll take a little pause to think of possible consequences.

P.S. There are async containers that needs to be updated accordingly: Formality__FormAsyncOnBlur.re & Formality__FormAsyncOnChange.re.

input: data,
status: FormStatus.Submitted,
fields: state.fields->Map.map(_ => Validation.Pristine),
});
| None => React.Update({...state, status: FormStatus.Submitted})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about None case?

Copy link
Contributor Author

@steinararnason steinararnason Feb 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this should also reset the forms dirty state in my opinion

…ded reset onto the case where none is supplied to notifyOnSuccess
@steinararnason
Copy link
Contributor Author

steinararnason commented Feb 25, 2019

Totally forgot to update the Async form, my bad 😅(done now)
Take your time with it and let me know if there's anything I can do to help 🙂

@alex35mil
Copy link
Member

@steinararnason Sorry for the delay. PR is looking good, thanks!

@alex35mil alex35mil merged commit 3b2042a into shakacode:master Apr 10, 2019
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

Successfully merging this pull request may close these issues.

2 participants