WebIDE asks for confirmation to leave the page when committing and creating a new MR
Summary
WebIDE asks for confirmation to leave the page when committing and creating a new MR.
Steps to reproduce
- Open a file in the WebIDE
- Make some changes
- Click the
Commit
button - Check the
Start a new merge request
checkbox - Click the
Stage & Commit
button
What is the current bug behavior?
Browser asks for confirmation to leave the page.
What is the expected correct behavior?
Browser should only ask for confirmation to leave the page when there are uncommitted changes.
Relevant logs and/or screenshots
The dialog is controlled by the browser, in Firefox it looks like this:
Output of checks
This bug happens on GitLab.com
Possible fixes
We register a window.onbeforeunload
handler at https://gitlab.com/gitlab-org/gitlab-ce/blob/6fd2cef0461bfba50fb1d1346c12a47053ec344f/app/assets/javascripts/ide/components/ide.vue#L58, which checks this.someUncommittedChanges
to decide if the dialog should be triggered or not. There might be a timing problem where the redirect to the MR form is triggered before this status is updated.
Edited by Markus Koller