From d321131ce3215ffe4e1a611171645a433a57be86 Mon Sep 17 00:00:00 2001 From: Ronni Skansing Date: Fri, 12 Jun 2026 10:49:44 +0200 Subject: [PATCH] fix settings history back Signed-off-by: Ronni Skansing --- frontend/src/routes/company/[id]/+page.svelte | 5 ++++- frontend/src/routes/settings/+page.svelte | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/routes/company/[id]/+page.svelte b/frontend/src/routes/company/[id]/+page.svelte index ef112e0..8f7b15a 100644 --- a/frontend/src/routes/company/[id]/+page.svelte +++ b/frontend/src/routes/company/[id]/+page.svelte @@ -66,7 +66,10 @@ const selectTab = (id) => { active = id; - window.location.hash = id; + // replace the current history entry instead of pushing a new one, so + // switching tabs does not stack up history and the back button leaves + // the page rather than walking back through each visited tab + history.replaceState(history.state, '', `#${id}`); }; const load = async () => { diff --git a/frontend/src/routes/settings/+page.svelte b/frontend/src/routes/settings/+page.svelte index effb9a1..9b70a05 100644 --- a/frontend/src/routes/settings/+page.svelte +++ b/frontend/src/routes/settings/+page.svelte @@ -53,7 +53,10 @@ const selectTab = (id) => { active = id; - window.location.hash = id; + // replace the current history entry instead of pushing a new one, so + // switching tabs does not stack up history and the back button leaves + // the page rather than walking back through each visited tab + history.replaceState(history.state, '', `#${id}`); };