Skip to content

Commit

Permalink
GDB-7642: Cherry-pick from 2.3
Browse files Browse the repository at this point in the history
## What
When the 'Resource' view is open, after clicking on a resource link in the SPARQL view result table and then clicking on the browser back button, the 'Resource' view is reloaded instead of returning the user back to the SPARQL view.

## Why
When the page is loaded, the URL is changed. It is modified with the 'role' URL parameter being added to it. The page has buttons that change the value of this parameter when clicked on. The modification of the parameter causes the browser to add a new history entry for every modification of the URL. As a result, when the user clicks on the back button, they are returned to the same page instead of the page they came from.

## How
Removes the last history entry from the browser history after every modification of the URL.
  • Loading branch information
boyan-tonchev committed Jul 20, 2023
1 parent 8b6fc50 commit acf67e1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/js/angular/explore/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ function ExploreCtrl($scope, $http, $location, toastr, $routeParams, $repositori
}
// Remember the role in the URL so the URL is stable and leads back to the same view
$location.search('role', $scope.role);
// Changing the URL parameters adds a history entry in the browser history, and this causes incorrect behavior of the browser's back button functionality.
// To resolve this issue, we replace the current URL without adding a new history entry.
$location.replace();
// wait for principal request if it has not finished and then fetch graph
Promise.resolve(principalRequestPromise)
.then(() => getGraph());
Expand Down

0 comments on commit acf67e1

Please sign in to comment.