Resetting form.state.isDirty on successful submission #1144
Unanswered
saoirse-reid
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, our app shows a confirmation modal when attempting to navigate away when a form is dirty. This is the desired behaviour when cancelling or hitting a link to a different page, but it also occurs from default navigations as the result of successful form submission.
We have gotten around this by calling
form.reset()
immediately before navigation, but that also flashes form values back to their defaults which is an undesirable visual.We have also tried looping over keys and setting
form.setFieldMeta(key, { isDirty: false })
for each, but while it works, it's less elegant than I would like.Is there any way to reset a form's isDirty property without mapping over keys or resetting the entirety of the form?
Beta Was this translation helpful? Give feedback.
All reactions