Skip to content

Fix unnecessary navigation modal in pipeline editor

What does this MR do and why?

Fixes the bug where if a user in the pipeline editor created a new commit and wanted to open a merge request, they would see a notification to confirm they wanted to leave the page. However since they have committed their changes, we shouldn't show the modal. The bug occurs because the root parent (pipeline_editor_app) has a computed property called hasUnsavedChanges which is what we use to determine if we should show the browser alert to prevent navigation. However after the commit, the computed property has not yet been updated and so the alert appears anyway.

This MR fixes this by waiting after the UI update before navigating away. It also has the benefit of clearly showing that the commit was successful before navigating away.

Also, while I was adding feature test to test this new behaviour, I decided to also address an older issue about testing that very same browser alert.

Screenshots or screen recordings

Before After
Screen_Recording_2022-01-25_at_3.10.25_PM Screen_Recording_2022-01-24_at_2.47.25_PM

How to set up and validate locally

  1. Go to CI/CD => Editor
  2. Make modification to your CI config
  3. Change the target branch to a new, non-existing branch
  4. Check the Start a new merge request with these changes checkbox
  5. Commit
  6. Notice that you see the success banner with a message that says you are being redirected.
  7. Notice that you are redirected to create a MR

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #350503 (closed)

Edited by Frédéric Caplette

Merge request reports