blitz-js / blitz-js/legacy-framework

react-hook-form button is not disabled for long enough

Open
#7 4 comments 0 reactions 0 assignees View on GitHub
legacy-framework status/triage
Dominant language
JavaScript
Stars
3
Forks
2
PR merge metrics
No merged PRs in 30d

Description

### What do you want and why?
I am using react-hook-form and the `new.tsx` pages that get generated always have this part:
``

This means that after the form has been submitted successfully and `isSubmitting` is false again, we can double submit the form before the route changes (especially on slower connections) and create a second new entity by accident.

I'd like to do something like `disabled={ctx.formState.isSubmitSuccessful || ctx.formState.isSubmitting}` to prevent this accidental double submit.

### Possible implementation(s)
Adding `ctx.formState.isSubmitSuccessful` should be possible pretty easy as documented in [react-hook-form formState documentation](https://react-hook-form.com/api/useform/formstate).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.