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
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Formality__Form.re
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,12 @@ module Make = (Form: Form) => {
| SetSubmittedStatus(data) =>
switch (data) {
| Some(data) =>
React.Update({...state, input: data, status: FormStatus.Submitted})
React.Update({
...state,
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

}

Expand Down