mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 20:42:43 +00:00
The Settings → Dashboard sub-section's Save button silently 422'd once the user had touched any per-chart overlay popover. Root cause was a Zod v4 semantics change: `z.record(z.enum(KEYS), ...)` now requires every enum key to be present in the input, where Zod v3 treated the same shape as a partial record. Real-world Save payloads only carry the chart keys the user actually toggled, so every Settings → Dashboard Save attempt with one or two `chartOverlayPrefs` entries failed with `expected: object, path: ["chartOverlayPrefs", "<missing-key>"]` and the toast surfaced "Layout konnte nicht gespeichert werden". Fix uses `z.partialRecord(z.enum(KEYS), ...)` which preserves the original v1.4.18 intent — per-chart opt-in overlay prefs, missing keys filled by the resolver. The inner object now also accepts the `comparisonBaseline` field so a Settings save preserves the per-chart comparison toggle the user set via the chart-card popover (otherwise Zod's default strip behaviour wiped it on every save). New integration suite pins: - partial chartOverlayPrefs round-trips - per-chart comparisonBaseline survives a Settings save - empty chartOverlayPrefs still persists (fresh accounts) - widget toggle changes land in the DB