From ac447fd318d676425ef76130bc297e2d0bbe749b Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 9 Sep 2020 16:52:48 +0100 Subject: [PATCH] Fix onNewScreen to use replace when going from roomId->roomAlias to prevent locking the user in place --- src/vector/app.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/vector/app.tsx b/src/vector/app.tsx index 445a37ba55..bc9a4fdb11 100644 --- a/src/vector/app.tsx +++ b/src/vector/app.tsx @@ -71,11 +71,16 @@ function onHashChange(ev: HashChangeEvent) { // This will be called whenever the SDK changes screens, // so a web page can update the URL bar appropriately. -function onNewScreen(screen: string) { +function onNewScreen(screen: string, replaceLast = false) { console.log("newscreen " + screen); const hash = '#/' + screen; lastLocationHashSet = hash; - window.location.hash = hash; + + if (replaceLast) { + window.location.replace(hash); + } else { + window.location.assign(hash); + } } // We use this to work out what URL the SDK should