-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
Situation:
- some kind of update form is rendered (e.g user profile update page)
- user hits submit but request is not made because form is pristine
- user changes an input or two
- user hits submit, form is not pristine anymore and request is made
- user hits submit again after response, request is made again
If user submits their changes and it gets acknowledged by server, form is considered pristine again in my book.
Tried something like this but I'm not sure if correct reference reaches form state. Noticed some issues.
function submitForm() {
// if values are the same, there's
// no point to make a request
if (form.isPristine()) return;
updateEntityOnServer({
variables: form.values
}).then(response => {
// make all values pristine again
Object.keys(form.pristine).forEach(key => {
form.pristine[key] = true;
});
// other stuff...
});
}Would be great to have something like this:
form.resetPristine();martinliptak and omer-pon
Metadata
Metadata
Assignees
Labels
No labels