forge42dev / remix-hook-form

Open source wrapper for react-hook-form aimed at Remix.run
MIT License
330 stars 27 forks source link

reset method does not accept options #73

Closed Roanmh closed 7 months ago

Roanmh commented 7 months ago

React Hook Form's reset() method (returned by useForm()) allows options to be submitted to a second argument. This library omits that argument.

I came across this due to another issue: After updating values in a form and submitting them, the form does not use the new values when calculating isDirty. I found that reset() is the documented method for React Hook Form. I saw that Remix Hook Form performs a similar update (if the action returns {defaultValues: {}}, but only in the case of an error return. Perhaps Remix Hook Form could perform the reset or update the values automatically on success? Or maybe I've missed something about this library?

I plan to write a PR for the change to reset() since it's blocking my current work and seems trivial. Please let me know if this is something you would accept. Any input on the larger issue is appreciated as well.

Thanks for your work on this repo!