Browser back button on mouse requires double-click to navigate away from issues page due to URL rewriting

Summary

When navigating to a project's issues page and then using the mouse back button, the browser goes to an intermediate "pre-rewrite" URL state before returning to the actual previous page, requiring two back button clicks instead of one.

Steps to reproduce

  • Within a project, navigate from any non-issues page (e.g., repository, merge requests) to the issues page
  • Observe the URL in the address bar (may change/be rewritten)
  • Click the 'back' button on your mouse
  • Observe you're taken to what appears to be a pre-address-bar-rewrite version of the issues page
  • Click the 'back' button again on your mouse
  • Now you return to the original page (repository, etc.)

What is the current bug behavior?

The issues page URL rewriting creates an extra entry in the browser history. When using the mouse back button, users must click twice—once to go to the intermediate URL state, and once more to return to the actual previous page.

What is the expected correct behavior?

Clicking the back button once should return the user directly to the page they were on before navigating to the issues page, without an intermediate URL state.

Relevant logs and/or screenshots

Demo (GitLab internal only)