Skip to content

Emergency: self-destruct service worker to clear broken cache#30

Merged
Varnasr merged 1 commit into
mainfrom
claude/fix-sw-cache
May 27, 2026
Merged

Emergency: self-destruct service worker to clear broken cache#30
Varnasr merged 1 commit into
mainfrom
claude/fix-sw-cache

Conversation

@Varnasr
Copy link
Copy Markdown
Owner

@Varnasr Varnasr commented May 27, 2026

Emergency fix — site not loading

The service worker from PR #28 (v3.0.0) pre-cached the broken HTML where app.js loaded after Alpine. Even though PR #29 fixed the script order, any browser that visited during the broken window has stale cached content served by the SW, preventing the site from loading.

Fix

Replace sw.js with a self-destructing stub that:

  1. Immediately activates (skipWaiting)
  2. Deletes ALL caches
  3. Unregisters itself

On next visit, the browser detects the new sw.js (byte-differs from old), installs it, the activate handler wipes caches and unregisters. All subsequent loads go straight to the network — no SW interference.

We can reintroduce a proper service worker later with safer cache invalidation. Getting the site loading is priority.

Test plan

  • Site loads (the main thing)
  • DevTools → Application → Service Workers → shows "unregistered" or nothing
  • DevTools → Application → Cache Storage → empty
  • All tabs, dark mode, charts work

Generated by Claude Code

The SW from v3.0.0 pre-cached the broken HTML (app.js in wrong
position). Even after PR #29 fixed the script order, any browser
that visited during the broken window has stale content in its
SW cache, preventing the site from loading.

Fix: replace sw.js with a self-destructing stub that:
1. Immediately activates (skipWaiting)
2. Deletes ALL caches
3. Unregisters itself

On next visit, the browser fetches the new sw.js (byte-differs
from the old one), installs it, the activate handler wipes caches
and unregisters. Subsequent loads go straight to the network with
no SW interference.

We can re-introduce a proper SW later with more careful cache
invalidation. For now, getting the site loading is priority.

Version meta bumped to 3.0.2.
@Varnasr Varnasr merged commit a9d637e into main May 27, 2026
1 check passed
@Varnasr Varnasr deleted the claude/fix-sw-cache branch May 27, 2026 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants