From 79ce836335373272534eb94741e8df718129ded7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sat, 6 Jun 2026 23:14:04 +0200 Subject: [PATCH] fix(settings): guard notification panel against non-array status payload The notifications settings panel white-screened with "x.map is not a function" when a status payload reached the card as the whole { channels, events } object instead of the channels array (events is an object map, not an array). Guard the channel map with an Array.isArray check, default the mood reminder-hour read to optional chaining, and add a regression test that renders the empty state instead of crashing on a malformed payload. --- .../medications/sections/notifications-section.tsx | 2 +- .../__tests__/notification-status-card.test.tsx | 14 ++++++++++++++ src/components/settings/mood-reminder-card.tsx | 2 +- .../settings/notification-status-card.tsx | 7 ++++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/components/medications/sections/notifications-section.tsx b/src/components/medications/sections/notifications-section.tsx index d4a089453..07d2eccff 100644 --- a/src/components/medications/sections/notifications-section.tsx +++ b/src/components/medications/sections/notifications-section.tsx @@ -201,7 +201,7 @@ export function NotificationsBody({ )} - {status && status.channels.length > 0 && ( + {Array.isArray(status?.channels) && status.channels.length > 0 && (