Disable submit buttons while submitting to avoid duplicate api request. Closes #903#915
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes a UI bug in the frontend auth flows where submit buttons could remain enabled while a Formik submission is in progress, allowing users to trigger duplicate API requests (Issue #903).
Changes:
- Update submit button
disabledlogic to disable when the form is invalid or whenformik.isSubmittingis true. - Apply the fix consistently across Login, Register, Reset Password, and the shared Email form component.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| frontend/src/components/auth/utils/EmailForm.jsx | Disable submit while submitting to prevent duplicate resend-email requests. |
| frontend/src/components/auth/ResetPassword.jsx | Disable submit while submitting to prevent duplicate reset-password requests. |
| frontend/src/components/auth/Register.jsx | Disable submit while submitting to prevent duplicate registration requests. |
| frontend/src/components/auth/Login.jsx | Disable submit while submitting to prevent duplicate login requests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…icated api request
618c32e to
eb88e81
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
regulartim
left a comment
There was a problem hiding this comment.
Hey @UsamaElareeny ! Your fix is solid, minimal and correct (as far as I can see). 👍 Would you please react to Copilots suggestions regarding the tests? At least some of them seem to be valid.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @regulartim , thanks for the fast feedback. Yes, they're pretty legit. I reacted to them :) |
Closes GreedyBear-Project#903 (GreedyBear-Project#915) * Fix auth forms: disable submit buttons while submitting to avoid duplicated api request * tests/awaited submission to settle before finishing the test + fixed some typos * using async waitFor to avoid a race test
Description
Disabled the submit buttons while submitting. This way it avoids multiple api requests triggered by the user.
Related issues
Related Issue #903
Type of change
Formalities
<feature name>. Closes #999develop.develop.Docs and tests
Ruff) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.