diff --git a/public/app.css b/public/app.css index 3b5cd07..16a52bd 100644 --- a/public/app.css +++ b/public/app.css @@ -19,6 +19,7 @@ } *{ box-sizing:border-box; } +.hidden{ display:none !important; } html{ background:var(--surface); } body{ margin:0; background:var(--surface); color:var(--ink); diff --git a/public/sw.js b/public/sw.js index 87ad060..b18d5d2 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1,4 +1,4 @@ -const CACHE_NAME = "roast-planner-static-v2"; +const CACHE_NAME = "roast-planner-static-v3"; const APP_SHELL = [ "/", "/landing.html", @@ -64,18 +64,17 @@ self.addEventListener("fetch", (event) => { return; } + // Prefer fresh JavaScript and styles so installed clients receive UI/security updates + // immediately; use the cache only when offline. event.respondWith( - caches.match(request).then((cached) => { - const update = fetch(request) - .then((response) => { - if (response.ok) - caches - .open(CACHE_NAME) - .then((cache) => cache.put(request, response.clone())); - return response; - }) - .catch(() => cached); - return cached ?? update; - }), + fetch(request) + .then((response) => { + if (response.ok) + caches + .open(CACHE_NAME) + .then((cache) => cache.put(request, response.clone())); + return response; + }) + .catch(() => caches.match(request)), ); });