Skip to content

Fix issue reporter not closing on submit and debounce submissions #123340

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

Merged
merged 3 commits into from
May 19, 2021
Merged

Fix issue reporter not closing on submit and debounce submissions #123340

merged 3 commits into from
May 19, 2021

Conversation

nrayburn-tech
Copy link
Contributor

Debounces the issue reporter submissions, so that a double click doesn't submit two different issues.
Fixes the issue reporter not closing when an issue has been submitted successfully.

I tried to use the debounce decorator, but couldn't get it working correctly with a return value so I went with the Delayer.

Testing

  1. Open the issue reporter and fill out the required info.
  2. Click the submit/preview button multiple times quickly (less than 300ms between clicks). (if you have github authenticated already, it will create multiple issues when testing this)
  3. Only a single issue should be submitted.
  4. The issue reporter should now close.

This PR fixes #115857

Old Behavior
old

New Behavior
new

@RMacfarlane
Copy link
Contributor

Hey @nrayburn-tech, thanks for submitting this!

The debounce is a great improvement! However, I don't think we want to close the reporter by default after the button is clicked. We can't guarantee that the issue has successfully been created on GitHub - we don't have any control after the API to open the browser is called, so though unlikely, there's a chance it could fail after that. To avoid losing data we keep the reporter open.

@nrayburn-tech
Copy link
Contributor Author

I reverted the change, it should only have the debounce now and all other behavior the same.

I was just aiming for consistency between the cmd+enter and the button. cmd+enter closes, but clicking does not. (In both cases, if the github API is called successfully the issue reporter is closed. This is only relevant for the openExternal calls.)

this.previewButton.onDidClick(() => this.createIssue());

// Cmd/Ctrl+Enter previews issue and closes window
if (cmdOrCtrlKey && e.keyCode === 13) {
if (await this.createIssue()) {
ipcRenderer.send('vscode:closeIssueReporter');
}
}

Copy link
Contributor

@RMacfarlane RMacfarlane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@RMacfarlane RMacfarlane added this to the May 2021 milestone May 19, 2021
@RMacfarlane RMacfarlane merged commit 05f83d9 into microsoft:main May 19, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jul 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The submit button on 'Report Issue' should have an debounce or other restriction
3 participants