mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 06:52:04 +00:00
fix(charts): persist the range-tab pick like the overlay toggles
rangePoints lived in plain useState(30), so every chart reset to the 30 d tab on mount while the sibling trend/comparison/target-band toggles on the same card persisted per chart. Add rangePoints to ChartOverlayPrefs (server-validated against the closed 0/7/30/90 set) and hydrate it once the prefs resolve; a range-tab tap now persists through the same PUT the toggles already use.
This commit is contained in:
1 parent
a66a346d0d
commit
3c468b5e00
4 files changed
+96
-1
No files matched your search
@@ -44,6 +44,12 @@ const prefsSchema = z.object({
|
||||
comparisonBaseline: z
|
||||
.enum(["none", "lastMonth", "lastYear"])
|
||||
.default("none"),
|
||||
// v1.30.1 — persisted range-tab selection (M2 QoL fix). Optional so
|
||||
// a client on an older cached bundle that never sends it doesn't
|
||||
// 422. Literal set mirrors `CHART_RANGE_POINTS` in dashboard-layout.
|
||||
rangePoints: z
|
||||
.union([z.literal(0), z.literal(7), z.literal(30), z.literal(90)])
|
||||
.optional(),
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user