Fix hash and query parameter ordering and repeating (#99)

This would happen after opening the "Add server" modal

Before:
```
/?search=&homeserver=foo.bar#/add-server?search=&homeserver=foo.bar
```

After:
```
/?search=&homeserver=foo.bar#/add-server
```
This commit is contained in:
Eric Eastwood 2022-10-21 01:14:06 -05:00 committed by GitHub
parent 6bb88b1ecd
commit 75d4a14845
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -28,22 +28,22 @@ class ArchiveHistory extends History {
// downstream call of `urlRouter.attach()` which we do when bootstraping // downstream call of `urlRouter.attach()` which we do when bootstraping
// everything. // everything.
if (window.history) { if (window.history) {
let replacingUrl = url; let replacingUrl = window.location.search + url;
// This is a way to make sure the hash gets cleared out // This is a way to make sure the hash gets cleared out
if (url === '') { if (url === '') {
replacingUrl = window.location.pathname; replacingUrl = window.location.pathname + window.location.search;
} }
super.replaceUrlSilently(replacingUrl + window.location.search); super.replaceUrlSilently(replacingUrl);
} }
} }
pushUrlSilently(url) { pushUrlSilently(url) {
let replacingUrl = url; let replacingUrl = window.location.search + url;
// This is a way to make sure the hash gets cleared out // This is a way to make sure the hash gets cleared out
if (url === '') { if (url === '') {
replacingUrl = window.location.pathname; replacingUrl = window.location.pathname + window.location.search;
} }
super.pushUrlSilently(replacingUrl + window.location.search); super.pushUrlSilently(replacingUrl);
} }
// Make the URLs we use in the UI of the app relative to the room: // Make the URLs we use in the UI of the app relative to the room: