From 75d4a14845b0410a0ba9e318c57a3505861122e7 Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Fri, 21 Oct 2022 01:14:06 -0500 Subject: [PATCH] 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 ``` --- shared/lib/archive-history.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/shared/lib/archive-history.js b/shared/lib/archive-history.js index 201eeda..29bee7e 100644 --- a/shared/lib/archive-history.js +++ b/shared/lib/archive-history.js @@ -28,22 +28,22 @@ class ArchiveHistory extends History { // downstream call of `urlRouter.attach()` which we do when bootstraping // everything. if (window.history) { - let replacingUrl = url; + let replacingUrl = window.location.search + url; // This is a way to make sure the hash gets cleared out if (url === '') { - replacingUrl = window.location.pathname; + replacingUrl = window.location.pathname + window.location.search; } - super.replaceUrlSilently(replacingUrl + window.location.search); + super.replaceUrlSilently(replacingUrl); } } pushUrlSilently(url) { - let replacingUrl = url; + let replacingUrl = window.location.search + url; // This is a way to make sure the hash gets cleared out 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: