fix(medications): the cards hold one shape and the list refetches on return

The low-supply notice moves onto the adherence meta row beside the streak —
a slot every card already reserves in every state — so a card that is low
on stock no longer inserts a row that pushes its bars out of line with the
card beside it. The gap between the drug class and the first line tightens
at the same time.

The medications list, compliance summary and supply reads now refetch on
every mount. App Router unmounts the page on navigation away and remounts
it on return; inside the client staleTime that return served a cache that
could be minutes old, hiding a dose logged on another device or surface. A
Playwright spec guards the return-navigation refetch.
This commit is contained in:
Marc-André Bombeck committed 2026-06-13 16:08:01 +02:00
1 parent f4dec8c28f
commit ff92ba46c2
5 files changed
+197 -59

No files matched your search

+9
View File
@@ -195,6 +195,15 @@ export default function MedicationsPage() {
return apiGet<Medication[]>("/api/medications");
},
enabled: isAuthenticated,
// v1.16.12 (#316) — refetch on every mount, even inside the global
// staleTime window. App Router unmounts this page on navigation away
// and remounts it on return; without this, a return within 5 min
// serves the cached list and shows nothing the user changed on
// another surface (the iOS app, a Withings sync, a second tab) — the
// client cache can't know to invalidate a cross-device write. "always"
// makes a return-visit fetch fresh; the per-user server cache keeps it
// cheap. Mutation-driven invalidation still covers same-tab writes.
refetchOnMount: "always",
});
// v1.16.11 — the same reminder-thresholds read the cards make (shared