Added pre-onSubmit callback to attach 'called' state#43
Added pre-onSubmit callback to attach 'called' state#43
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
Just noticed that there's also #41 for this, so this fixes that as well. |
Xevion
left a comment
There was a problem hiding this comment.
This still lets the person click the button a bunch, and it probably won't work if the submit button fails (network issue, error, anything other than "successful") - the button will be disabled forever.
I would recommend using React Hook Form to do this, as it's already using it.
While it does let the user click the button a bunch, I don't think that the fix fails if the other cases (e.g. network error) happen instead of a successful submission, as the 'called' state is set as soon as form is submitted. Do note that I did test this only for valid event creation. I also actually did find that same thread that you've linked, but I couldn't get that implementation to work and tried this one out. I'll try the other implementation again, but I'm still not totally sure as to what the benefit is in comparison to this one. On typing this out I now realize, and this might be what you're already saying, but there is still the issue of if a user submits a 'invalid' form, the 'called' state will be set as true, and it won't allow the user to correct the form for re-submission. This isn't too bad to fix with the current implementation. |
Fixes #42