How to avoid reseting the form after succesfull submission #606
-
Hey everyone, I'm working on an app that supports optimistic UI. I want users to submit a form and keep adding new records without the form resetting after each submission. My backend takes about 3 seconds to process. So, after a user adds a record, I show them an optimistic version and they continue adding more. However, after the 3 seconds it takes for the submission to succeed, the form resets. How can I prevent this reset? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
@edmundhung sorry to tag you, any solutions here, thanks 🙏 |
Beta Was this translation helpful? Give feedback.
-
@edmundhung In Next.js v15, it seems to always reset the form even though I have Next.js v15 is still unstable, and I cannot determine whether the bug is in conform or Next.js, so I will not create an issue. reproduction: |
Beta Was this translation helpful? Give feedback.
Conform does not reset the form by default. It will reset the form only if you call
form.reset()
in the form orsubmission.reply({ resetForm: true })
in the action. If you are still unsure about your case, please share a codesandbox or stackblitz that reproduce your issue.