mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
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
This commit is contained in:
parent
ae2e3e8502
commit
b23aad28ca
@ -73,6 +73,11 @@ function onNewScreen(screen: string, replaceLast = false) {
|
|||||||
const hash = '#/' + screen;
|
const hash = '#/' + screen;
|
||||||
lastLocationHashSet = hash;
|
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) {
|
if (replaceLast) {
|
||||||
window.location.replace(hash);
|
window.location.replace(hash);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user