mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 12:32:43 +00:00
Achievements: the bucket was 60 s hard-TTL while the app-wide unlock notifier polls every 2 minutes, so every poll landed on an expired entry and fired a cold ~400 ms rebuild in the foreground. Add a 10-minute stale-while-revalidate window and read the route through cachedSwr; the route already persists pendingUnlocks outside the cached factory, so a stale serve never skips an unlock write. Achievements builder: the vitals array ran through several full-array passes, each re-deriving a Berlin day-key (and hour) per row via Intl.DateTimeFormat. Compute each row's day-key once and thread the parallel array into the green-day, weekly-consistency, engagement, and hidden passes; the hidden pass reuses a single precomputed hour array. Results are byte-identical to the per-row derivation (parity test added). dashboard/summary: read through cachedSwr so the iOS-polled endpoint serves its existing 1 h stale window instead of re-paying the cold rebuild every 60 s on the plain cached path. Charts: route the three recharts consumers that bypassed the shared next/dynamic boundary (lab biomarker chart, sleep stage stacked bar, recommendation rationale charts) through dynamic imports with matching loading skeletons, taking recharts off the first-load JS for /labs/[id], /insights/sleep, and the insights recommendations surface.