From 24e6cff9d58dc97a034d0416623d58eff17db30c Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Sun, 30 Apr 2023 22:17:06 -0400 Subject: [PATCH] Update urls --- web-frontend/src/lib/url.js | 6 +++++- web-frontend/src/routes/+page.svelte | 4 +--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/web-frontend/src/lib/url.js b/web-frontend/src/lib/url.js index 096e34c..e5db0b2 100644 --- a/web-frontend/src/lib/url.js +++ b/web-frontend/src/lib/url.js @@ -25,11 +25,15 @@ export function createUrlStore(ssrUrl) { updateHref(); }; + history.replaceStateNoNotification = function () { + originalReplaceState.apply(this, arguments); + }; + window.addEventListener('popstate', updateHref); window.addEventListener('hashchange', updateHref); return { - subscribe: derived(href, ($href) => new URL($href)).subscribe + subscribe: derived(href, ($href) => new URL($href)).subscribe, }; } diff --git a/web-frontend/src/routes/+page.svelte b/web-frontend/src/routes/+page.svelte index f5a87f7..94fc259 100644 --- a/web-frontend/src/routes/+page.svelte +++ b/web-frontend/src/routes/+page.svelte @@ -76,8 +76,6 @@ coordinateTypes = rustEnumToArray(wasm.call.CoordinateType); selectedCoordinateType = coordinateTypes[0]; - - console.log('My url formats: ', urlFormats, wasm.call.CoordinateUrls); }) .then(async () => { leaflet = await import('leaflet'); @@ -150,7 +148,7 @@ coordinateInputValue = addr.allCoordinates[selectedCoordinateType]; } - history.replaceState(undefined, undefined, `#${addr.address.replaceAll(' ', '-')}`); + history.replaceStateNoNotification(undefined, undefined, `#${addr.address.replaceAll(' ', '-')}`); map.panTo(latlng, 20); leaflet.popup().setLatLng(latlng).setContent(`${addr.address}`).openOn(map);