From 26ab5dda756a3e0f07b8f996cc23c8e40078a314 Mon Sep 17 00:00:00 2001 From: Scott Idem Date: Wed, 3 Jun 2026 20:00:22 -0400 Subject: [PATCH] fix(service-worker): exclude /fonts/ from SW precache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 667 font files (~134MB) were being passed to cache.addAll() on every SW install. cache.addAll() is atomic — a single failed request aborts the entire install. Browser Cache Storage quota is typically 50-100MB on mobile, so the SW has likely been silently failing to install on most mobile devices, negating all caching and the skipWaiting fix. Only 3 font files are referenced by the browser (app.css). The rest are badge-print fonts for server/Electron use and do not need to be precached. The browser's normal HTTP cache handles them when the print page is visited. Co-Authored-By: Claude Sonnet 4.6 --- src/service-worker.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/service-worker.js b/src/service-worker.js index fa352b39..e9be0988 100644 --- a/src/service-worker.js +++ b/src/service-worker.js @@ -6,7 +6,12 @@ const CACHE = `cache-${version}`; const ASSETS = [ ...build, // the app itself - ...files // everything in `static` + // Exclude /fonts/ — 667 font files totalling ~134MB. Only 3 are used by the + // browser (app.css); the rest are badge-print fonts for server/Electron use. + // cache.addAll() is atomic, so including them would silently abort the entire + // SW install on most mobile devices (quota ~50-100MB). The browser's normal + // HTTP cache handles font requests when the print page is actually visited. + ...files.filter(f => !f.startsWith('/fonts/')) ]; self.addEventListener('install', (event) => {