update window.location.hash directly instead of cockpit.location.go

This commit is contained in:
joshuaboud 2022-05-30 13:19:39 -03:00
parent f41f3161eb
commit 58470f7dba
No known key found for this signature in database
GPG Key ID: 17EFB59E2A8BF50E

View File

@ -39,7 +39,7 @@ router.beforeEach(async (to, from) => {
if (to.name === 'root')
return `/browse${localStorage.getItem(lastPathStorageKey) ?? '/'}`;
if (to.fullPath === lastValidRoutePath) {
return true;
return true; // ignore from updating window.location.hash
}
if (to.name === 'browse') {
if (!to.params.path)
@ -61,7 +61,7 @@ router.beforeEach(async (to, from) => {
}
}
lastValidRoutePath = to.fullPath; // protect double-update from next line
cockpit.location.go(to.fullPath); // needed to update URL in address bar
window.location.hash = '#' + to.fullPath; // needed to update URL in address bar
return true;
})