Commit Graph

2 Commits

Author SHA1 Message Date
catarrh 30918e4f4a fix: no stale stylesheet from caches (v3.6.31)
Even with the rebuilt style.css, three caching paths could still serve the
old file:

- the server sent Cache-Control: no-cache only for index.html/sw.js, so
  browsers could heuristically cache style.css;
- the SW install precached with addAll(), which re-uses HTTP-cached copies,
  so a new SW version could precache the stale file;
- the fetch handler is cache-first (fine once the cache is fresh).

Now every static shell file is served with Cache-Control: no-cache plus
Last-Modified and cheap 304 revalidation, and the SW install fetches each
precache URL with cache: 'reload' (CACHE simple-v304).  A test pins the
install behaviour.

661 frontend / 504 Python green; version 3.6.31.

Note: the public demo simple.atroshin.ru is still v3.6.20 with the old
stylesheet - it needs a deploy of the current frontend/.
2026-09-28 23:40:24 +03:00
catarrh 450f1de68a sw: never resolve respondWith to undefined on offline navigation
When a navigation fetch failed and the cache had no entry for the exact
URL (e.g. '/' while only 'index.html' is precached, common while the
local server restarts), the fetch handler resolved respondWith() to
undefined, producing 'TypeError: Failed to convert value to Response'.

The navigate fallback now chains caches.match(request) -> cached
index.html -> an explicit 503 offline Response. sw.js requests are
network-only with the same offline Response (previously they fell into
the navigate branch), and a new unit test loads sw.js in a VM sandbox
covering navigate/cache/asset/api paths. SW cache v97 -> v98.
2026-09-12 14:33:31 +03:00