fix(dashboard): refetch the snapshot on window focus

The dashboard is exactly the surface a user leaves open in a background tab
while editing its tile selection elsewhere; with focus refetch off, the stale
layout sat visible for up to the poll interval — a save appeared to do
nothing, then 'worked' minutes later. staleTime still bounds the refetch to
once a minute and the server side is SWR-cached, so a focus flick is a cheap
cache hit. Chart batch series stay on the poll (heavier payloads; the tile
selection itself lives on the snapshot query).
This commit is contained in:
Marc-André Bombeck committed 2026-07-11 10:39:24 +02:00
1 parent 13464b512e
commit 8ee9c53b83
1 file changed
+7 -1
+7 -1
View File
@@ -65,7 +65,13 @@ import { VorsorgeDashboardCard } from "@/components/measurement-reminders/vorsor
// but the slot is one future-callback-field away from cache poisoning.
const DASHBOARD_QUERY_OPTS = {
staleTime: 60_000,
refetchOnWindowFocus: false,
// v1.28.28 — refetch on window focus: the dashboard is exactly the surface
// a user leaves open in a background tab while editing its tile selection
// elsewhere; without a focus refetch the stale layout sat visible for up to
// the poll interval ("saved but nothing changed"). staleTime still bounds
// the cost to at most one refetch per minute, and the server side is SWR-
// cached, so a focus flick is a cheap cache hit.
refetchOnWindowFocus: true,
} as const;
// v1.19.0 — day-span the batched dashboard series (`series-batch`) fetches.