Skip to content

PWA never calls registration.update() — long-lived sessions run a stale shell #274

Closed

Description

@mforce

Deployment-readiness gap (#244), RECOMMENDED — frontend.

Problem

A long-lived PWA session never re-checks for a new deploy, so barn phones keep running the old app shell against a freshly deployed API. The service-worker config is deliberately correct for avoiding mid-form swaps — registerType: "prompt", injectRegister: null, no skipWaiting (web/vite.config.ts) — and the manual registration handles waiting/installing/updatefound well (registerServiceWorker.ts). But there is no registration.update() call anywhere (no interval, no visibilitychange handler). A display: standalone PWA left open all day generates no navigation, so the browser never re-fetches sw.js, updatefound never fires, and the UpdatePrompt never appears — the client keeps serving the old precached index.html/shell against the new /api/v1. Stable URL versioning limits the blast radius, but a breaking deploy strands long-lived sessions until manual relaunch.

Fix

Add a periodic registration.update() (and one on visibilitychange → visible) so the update prompt can surface without a full reload. Keep the prompt-not-auto-update behavior. Ships with Vitest coverage (standing rule for web/ changes).

Verify

With a session open, deploy a new build; confirm the UpdatePrompt appears within the poll interval without a manual reload.

Part of the #244 deployment-readiness audit; tracked in epic #15.

Activity

  1. changed the title [-]Deploy: PWA never calls registration.update() — long-lived sessions run a stale shell[/-] [+]PWA never calls registration.update() — long-lived sessions run a stale shell[/+] on Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions