IKEA assembly, step by step: animated, manual-style 3D guides. Scan any paper manual with Together AI.
TypeScript
Service worker: fetch the voice clip list fresh
Youssef3e5a17d9b63a
diff --git a/public/sw.js b/public/sw.jsindex 93a2f7c..0f79b2d 100644--- a/public/sw.js+++ b/public/sw.js@@ -4,8 +4,8 @@* voice clips: cache first, they never change under the same name.* The API is never cached here.*/-const PAGES = "bygga-pages-v2";-const FILES = "bygga-files-v2";+const PAGES = "bygga-pages-v3";+const FILES = "bygga-files-v3";const KEEP = [PAGES, FILES];self.addEventListener("install", (e) => {@@ -52,6 +52,22 @@ self.addEventListener("fetch", (e) => {return;}+ // the clip list changes with every recording: network first, the last copy when offline+ if (url.pathname.endsWith("/manifest.json")) {+ e.respondWith(+ fetch(req)+ .then((res) => {+ if (res.ok) {+ const copy = res.clone();+ caches.open(FILES).then((c) => c.put(req, copy));+ }+ return res;+ })+ .catch(() => caches.match(req)),+ );+ return;+ }+if (url.pathname.startsWith("/_next/static/") || url.pathname.startsWith("/voice/") || /\.(woff2?|png|svg)$/.test(url.pathname)) {e.respondWith(caches.match(req).then(