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:
Marc-André Bombeck committed 2026-07-18 03:52:32 +02:00
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(),
}),
});