diff --git a/public/sw.js b/public/sw.js index f778a5239..2fe77d88e 100644 --- a/public/sw.js +++ b/public/sw.js @@ -1,7 +1,7 @@ /** * HealthLog service worker: Web Push, a page cache for public pages, and a - * static cache for catalogs and icons. API answers and app chunks are never - * stored here. + * static cache for catalogs, icons, fonts and images. API answers and app + * chunks are never stored here. */ // Cache names carry the release, so `activate` drops every older cache. The @@ -28,7 +28,7 @@ const CURRENT_HEALTHLOG_CACHES = new Set([STATIC_CACHE, PAGE_CACHE]); // Set by `src/proxy.ts` on every HealthLog page; same name as there. const HEALTHLOG_PAGE_MARKER_HEADER = "X-HealthLog-Page"; // While set, the fetch handler declines every request. Set when a page looks -// like another app, cleared when `confirmForeignOrigin` finds HealthLog. +// like another app, cleared unless the probe confirms another app. let foreignOrigin = false; // One confirmation at a time, shared by a burst of navigations. let foreignOriginCheck = null; diff --git a/src/__tests__/baselines/version-stamp-comments.json b/src/__tests__/baselines/version-stamp-comments.json index 7bbae47ac..6f553040c 100644 --- a/src/__tests__/baselines/version-stamp-comments.json +++ b/src/__tests__/baselines/version-stamp-comments.json @@ -1,7 +1,7 @@ { "$comment": "Comment lines that open with a release version, per file under src/. Maintained by src/__tests__/version-stamp-ratchet.test.ts.", - "count": 2876, - "total": 9163, + "count": 2875, + "total": 9162, "entries": { "__tests__/account-payload-consumer-guard.test.ts": 2, "__tests__/acting-account-boundary-guard.test.ts": 7, @@ -2581,7 +2581,6 @@ "lib/notifications/delegated-intake.ts": 2, "lib/notifications/dispatch-localised.ts": 3, "lib/notifications/dispatcher.ts": 3, - "lib/notifications/dose-tag.ts": 1, "lib/notifications/medication-intake-sync.ts": 1, "lib/notifications/senders/__tests__/apns.test.ts": 7, "lib/notifications/senders/__tests__/push-attempt-record.test.ts": 1, diff --git a/src/hooks/use-auth.ts b/src/hooks/use-auth.ts index e67541b74..0c84e4924 100644 --- a/src/hooks/use-auth.ts +++ b/src/hooks/use-auth.ts @@ -626,10 +626,10 @@ export function useAccountOnceMounted(): AuthUser | null { * former explicit `setQueryData(null)` + `invalidateQueries(["auth"])`. * * Then `clearOfflineCachesForSessionEnd()` wipes the persisted layers — the - * IndexedDB query snapshot, the SW offline read-data cache (`healthlog-data-*`), - * and the SW page cache (`healthlog-pages-*`, cached navigation HTML). The static - * cache (hashed chunks, icons) carries no PII and stays intact to avoid a - * needless re-download. Best-effort; never blocks the redirect. + * IndexedDB query snapshot, the SW page cache (`healthlog-pages-*`, cached + * navigation HTML) and any API cache an older worker left (`healthlog-data-*`). + * The static cache (catalogs, icons, fonts, images) carries no PII and stays + * intact to avoid a needless re-download. Best-effort; never blocks the redirect. */ export function clearCachesForSessionEnd(queryClient: QueryClient): void { queryClient.clear(); diff --git a/src/lib/notifications/dose-tag.ts b/src/lib/notifications/dose-tag.ts index 8b1af83fa..a955fde46 100644 --- a/src/lib/notifications/dose-tag.ts +++ b/src/lib/notifications/dose-tag.ts @@ -1,18 +1,10 @@ /** - * v1.18.4 — stable Web Push notification tag for a medication dose slot. + * Stable notification tag for a medication dose slot, `(medicationId, + * scheduledFor instant)`. A repeated reminder for the same dose replaces the + * one already shown instead of stacking a second. * - * A PWA self-hoster with no Apple Developer account has no Live Activity to - * end when a dose is logged. Instead the server pushes a `type: "clear"` - * web-push that the service worker turns into `getNotifications({ tag })` + - * `notification.close()`. For that to work the REMINDER push and the CLEAR - * push must agree on a single, stable tag per dose slot. - * - * The slot is uniquely identified by `(medicationId, scheduledFor-instant)`: - * - the dose-due reminder fires with `scheduledAt` = the slot's ISO instant, - * - the clear-on-taken fires with `scheduledFor` = the same ISO instant. - * - * `scheduledFor` is normalised through `Date` so a reminder ISO carrying - * milliseconds and a clear ISO without them still collapse to one tag. + * The instant is normalised through `Date`, so an ISO string with and one + * without milliseconds give the same tag. */ export function medicationDoseTag( medicationId: string,