Fix inline blame gutter requiring two clicks to open and close

What does this MR do and why?

Fixes two inline blame bugs (behind the inline_blame feature flag), both caused by the same pattern: two competing router navigations where the second one is built from a stale route and cancels or overwrites the first.

  1. Opening: clicking a line number link only appended #L<n> to the URL; a second click was needed to open the blame gutter. The blame=1 push was cancelled by a hash-only replace built from the stale route.
  2. Closing: clicking the header Blame button once didn't close the gutter. The toggle pushed a route removing blame, which flipped the header state and triggered viewer-changed; handleViewerChanged then pushed a second route built from the stale query still containing blame=1, reopening the gutter (and cancelling the first push, an unhandled rejection in vue-router 3).

Both are fixed by issuing a single navigation that carries all query and hash changes together: opening threads the line hash through the blame=1 push, and closing is owned entirely by handleViewerChanged, which strips blame, sets plain, and preserves the line hash.

Screenshots or screen recordings

How to set up and validate locally

  1. Ensure the inline_blame feature flag is enabled (default-enabled beta).
  2. Open any text file blob page.
  3. Click a line number link once, the URL gains ?blame=1 and #L<n>, and the gutter opens.
  4. Click the header Blame button once, the gutter closes, blame is removed from the URL, and the #L<n> anchor is preserved.

References

MR acceptance checklist

Evaluated against the MR acceptance checklist.

Edited by Jacques Erasmus

Merge request reports

Loading
Loading