Skip to content

v29.6

Choose a tag to compare

@Phinetwork Phinetwork released this 19 Dec 07:54
· 92 commits to main since this release
4410a14

Release Notes — v29.6

PWA Offline Fix (Service Worker Routing Hardening)

Summary

This release restores true offline-first PWA behavior by preventing service worker scripts from being swallowed by the SPA catch-all route. sw.js (and service-worker.js, if you ship both) are now served as real JavaScript files end-to-end, allowing the browser to install, register, cache, and claim clients reliably.


What changed

✅ Service worker scripts are served directly (no SPA rewrite)

  • Ensured requests to:

    • /sw.js
    • /service-worker.js (if present)
  • are handled as static JS assets and never rewritten to your app’s index.html via SPA fallback rules.

✅ Correct MIME + payload delivered

  • These endpoints now return JavaScript, not HTML.
  • This fixes the classic failure mode where the browser tries to execute index.html as the worker script, causing install/register to silently fail or loop.

Why it matters

Offline-first is back

With service worker routing fixed, the PWA regains its core guarantees:

  • Reliable service worker registration
  • Asset + route caching behaves deterministically
  • Clients are claimed properly (navigation + control works immediately)
  • Offline navigation works (cached shell/pages render without network)
  • Background sync / update flows resume (where supported)

In short: the PWA works like a PWA again — installable, resilient, and offline-capable.


How to verify

1) Confirm service worker script responses are JS

After redeploy:

  1. Open DevTools → Network

  2. Visit:

    • /sw.js
    • /service-worker.js (if applicable)
  3. Confirm:

    • Status: 200
    • Content-Type: application/javascript (or equivalent JS type)
    • Response body: actual worker JS (not HTML)

If you see <!doctype html> anywhere in the response, the SPA fallback is still intercepting it.


2) Validate install + claim in a clean session

  1. Open a fresh Incognito window

  2. Load the site once

  3. DevTools → ApplicationService Workers

  4. Confirm:

    • Service worker is installed
    • Service worker is activated
    • Clients are claimed (page shows “controlled by service worker”)

3) Confirm offline navigation works

  1. With the app loaded and the worker installed, toggle:

    • DevTools → Network → ✅ Offline
  2. Navigate between routes (or hard reload if your caching strategy supports it)

  3. Confirm:

    • App shell loads
    • Cached pages/assets render without network
    • No “online-only” blank screens

Notes

  • This fix is intentionally boring and absolute: service worker scripts must never be routed through SPA HTML fallbacks.
  • If you ship both sw.js and service-worker.js, keep them both protected from rewrites to avoid environment-specific failures.

v29.6 restores offline-first behavior by making the worker script endpoints untouchable by SPA rewrites.

What's Changed

Full Changelog: v29.5.5...v29.6