Reimplement the refreshCurrentPage JS functionality

What does this MR do and why?

Reimplement the refreshCurrentPage JS functionality

The previous implementation relied on window.location.assign. If the URL contained a hash it caused to navigate to the specified portion, instead of reloading the page.

window.location.reload is a more robust functionality that causes the browser to refresh regardless if the URL contains a hash or not.

Changelog: fixed

References

Screenshots or screen recordings

No changes

How to set up and validate locally

  1. Open a browser dev console in this MR
  2. See the different behaviour with these two methods
window.location.assign('https://gitlab.com/gitlab-org/gitlab/-/merge_requests/202971#references');

window.location.reload();

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Eduardo Sanz García

Merge request reports

Loading