diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 819e82be..56d32466 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -344,7 +344,12 @@ $effect(() => { // silently runs whatever JS it had at the time the SW changed. This caused IDAA and // other users to run stale code for weeks at a time across multiple deployments. // Added 2026-06-22 to close this gap. - const on_controller_change = () => window.location.reload(); + // Capture before registering — if null, this is first activation (fresh page load) + // and the reload is unnecessary since assets were already fetched without the SW. + const had_controller = !!navigator.serviceWorker.controller; + const on_controller_change = () => { + if (had_controller) window.location.reload(); + }; if ('serviceWorker' in navigator) { navigator.serviceWorker.addEventListener('controllerchange', on_controller_change); }