Skip to content

Avoid duplicate history entries for the same line position

Created by: fkling

In a way this is a continuation of #38193.

In noticed that clicking the same line multiple times adds a separate history entry for every click. That's not a great experience wrt navigating back and forth.

This is done by comparing the URL query parameters and their values. Location is encoded as a query parameter without a value, so if the location changed then trying to look up the same paremeter in the new URL will return null (and therefore be different from an empty string).

Before/after video: I wanted to add overlay text to indicate where the version begins but I hope it's clear without it. Also note that mouse clicks are not visible in the video. I'm moving the mouse before clicking to make it clearer when I click.

https://user-images.githubusercontent.com/179026/177300042-b7403d95-16e6-4330-a651-2560df3bf8e8.mp4

Test plan

Click on a couple of lines in a file multiple times. Clicking the back button directly goes to the previous line, no matter how often a line was clicked.

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading