fix: browser back button after searching does not behave properly

Switch URL updating strategy from pushState to replaceState in order to avoid pushing all search queries to the browser history

Fix #1166
This commit is contained in:
momchil-anachkov authored and George committed 2019-07-01 11:27:05 +01:00
1 parent bb3d35133e
commit e4f0e80dfb
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -43,8 +43,8 @@ function getSearchQuery(name) {
// Set query in URI without reloading the page.
function updateURL(url) {
if (history.pushState) {
window.history.pushState({path:url}, '', url);
if (history.replaceState) {
window.history.replaceState({path:url}, '', url);
}
}
+2 -2
View File
@@ -50,9 +50,9 @@
}
function removeQueryParamsFromUrl() {
if (window.history.pushState) {
if (window.history.replaceState) {
let urlWithoutSearchParams = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.hash;
window.history.pushState({path:urlWithoutSearchParams}, '', urlWithoutSearchParams);
window.history.replaceState({path:urlWithoutSearchParams}, '', urlWithoutSearchParams);
}
}