From a0539ff5f98eee1576eb0bd2dbf1f1ed27e1bee1 Mon Sep 17 00:00:00 2001 From: Emily-Ke <50299119+Emily-Ke@users.noreply.github.com> Date: Fri, 26 Aug 2022 14:43:16 -0700 Subject: [PATCH] Fix page error when no notification message (#452) --- src/pages/notifications/Notifications.jsx | 105 +++++++++++----------- 1 file changed, 53 insertions(+), 52 deletions(-) diff --git a/src/pages/notifications/Notifications.jsx b/src/pages/notifications/Notifications.jsx index 462236f6e..0cf001664 100644 --- a/src/pages/notifications/Notifications.jsx +++ b/src/pages/notifications/Notifications.jsx @@ -100,58 +100,59 @@ export default function Notifications() { const createdDate = notification?.created; const timeSince = calculatePrettyTimeElapsedSince(createdDate); - const notificationText = ( - - {intl.formatMessage( - { - id: currentNotificationSchema?.notificationMessage, - }, - { - userName: ( - - - {userName} - - - ), - user1Name, - user2Name, - yourIndividualName: ( - - - {yourIndName} - - - ), - theirIndividualName: ( - - - {theirIndividualName} - - - ), - formattedDeadline, - }, - )} - - ); + const notificationText = + currentNotificationSchema?.notificationMessage ? ( + + {intl.formatMessage( + { + id: currentNotificationSchema.notificationMessage, + }, + { + userName: ( + + + {userName} + + + ), + user1Name, + user2Name, + yourIndividualName: ( + + + {yourIndName} + + + ), + theirIndividualName: ( + + + {theirIndividualName} + + + ), + formattedDeadline, + }, + )} + + ) : null; const howLongAgoText = (