mirror of https://github.com/vector-im/riot-web
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 changepull/18053/head
parent
ae2e3e8502
commit
b23aad28ca
|
@ -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…
Reference in New Issue