Browse Source

Fix browser history getting stuck looping back to the same room

E.g if you click a link to room/#foo:bar?via=baz we'll redirect to room/#foo:bar and now hitting back takes you back to the ?via=baz and means you have to hit back twice without this change
pull/18053/head
Michael Telatynski 6 months ago
parent
commit
b23aad28ca
  1. 5
      src/vector/app.tsx

5
src/vector/app.tsx

@ -73,6 +73,11 @@ function onNewScreen(screen: string, replaceLast = false) {
const hash = '#/' + screen;
lastLocationHashSet = hash;
// if the new hash is a substring of the old one then we are stripping fields e.g `via` so replace history
if (screen.startsWith("room/") && window.location.hash.startsWith(hash)) {
replaceLast = true;
}
if (replaceLast) {
window.location.replace(hash);
} else {

Loading…
Cancel
Save