forge42dev / remix-hook-form

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

`isSubmitting` flashes `false` during form submission #101

Closed MonsterDeveloper closed 1 month ago

MonsterDeveloper commented 2 months ago

For a brief moment during the submission isSubmitting is set to false for some reason.

I created this sample CodeSandbox for bug reproduction. If you open a console, you'll see the following logs after form submission: CleanShot 2024-07-03 at 10 55 29@2x

Here in red I highlighted the lines that I believe cause trouble.

I took a look at the source code, and it seems that there's a gap between the moment when internal react-hook-form isSubmitting is set to false and the moment when the navigation.state kicks in.

Here's how I see it: image

This wouldn't be a big deal, but I'm currently trying to create an animation based on this state and it flashing to false during the submission is hard to overcome.

Not sure how to fix it yet.