Skip to content

Conversation

@yakov116
Copy link
Member

@yakov116 yakov116 commented Aug 5, 2020

  1. LINKED ISSUES:
    Closes Prevent accidentally creating duplicate pull requests #3398

  2. TEST URLS:
    Create a new PR

  3. SCREENSHOT:
    Video_2020-08-05_091405

Copy link
Member

@fregante fregante left a 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()

@fregante fregante changed the title Add prevent-duplicate-pull-request-submission feature Add prevent-duplicate-pr-submission feature Aug 5, 2020
@yakov116
Copy link
Member Author

yakov116 commented Aug 6, 2020

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>
yakov116 and others added 3 commits August 6, 2020 09:13
Co-authored-by: Federico <opensource@bfred.it>
@yakov116 yakov116 requested a review from fregante August 6, 2020 22:46
Co-authored-by: Federico <opensource@bfred.it>
@yakov116 yakov116 mentioned this pull request Aug 7, 2020
@fregante fregante merged commit ecad0ae into refined-github:master Aug 10, 2020
@yakov116 yakov116 deleted the no-dup-pr branch August 10, 2020 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

Prevent accidentally creating duplicate pull requests

2 participants