fix(service-worker): exclude /fonts/ from SW precache

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 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-06-03 20:00:22 -04:00
parent 0511d9591f
commit 26ab5dda75

View File

@@ -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) => {