-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Add prevent-duplicate-pr-submission feature
#3433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a problem with disabling buttons on submit:
- if I quickly press esc after submitting (to attempt cancelling the submission) a disabled button won't let me re-try
- if the submission fails and the browser displays the "no connection" page, when pressing "back" the form will still be disabled
I think, perhaps, the safest way to handle this is to just block quick sequential submissions via events, like:
on submit
if (Date.now() - previousSubmission < 1000)
preventDefault()
previousSubmission = Date.now()prevent-duplicate-pull-request-submission featureprevent-duplicate-pr-submission feature
|
What I committed works. I am not sure why but if I listed to the submit event it does not work. What should the screenshot be of? |
Co-authored-by: Federico <opensource@bfred.it>
Co-authored-by: Federico <opensource@bfred.it>
Co-authored-by: Federico <opensource@bfred.it>
LINKED ISSUES:
Closes Prevent accidentally creating duplicate pull requests #3398
TEST URLS:
Create a new PR
SCREENSHOT:
