Files
astro-website/openspec/changes/service-workers/tasks.md
Santhosh Janardhanan 12e7eae95a
Some checks failed
ci / site (push) Has been cancelled
publish-image / publish (push) Has been cancelled
Fix service workers
2026-02-10 04:54:05 -05:00

983 B

1. Setup

  • 1.1 Add sw.js to site root output (place in site/public/sw.js)
  • 1.2 Add service worker registration to the base layout (register only in production)

2. Pre-cache Site Shell

  • 2.1 Implement versioned cache names and an explicit cache version constant
  • 2.2 Implement install handler to pre-cache critical shell assets
  • 2.3 Implement activate handler to delete old version caches

3. Runtime Caching

  • 3.1 Implement network-first strategy for navigation/document requests with cache fallback
  • 3.2 Implement cache-first strategy for images/media with network fallback
  • 3.3 Add a bounded eviction policy for media cache size

4. Verification

  • 4.1 Verify service worker registers in production build and does not register in dev
  • 4.2 Verify repeat navigation and asset loads hit cache (Chrome DevTools Application tab)
  • 4.3 Verify a new deploy triggers cache version update and old caches are removed