From 3950fa0e6b28397e0f905dab19bfc5d809c2ebea Mon Sep 17 00:00:00 2001 From: Kevin Szuchet Date: Thu, 5 Sep 2024 16:57:00 +0100 Subject: [PATCH] fix: Check if the notification has a mapped component --- .../Notifications/NotificationsFeed.tsx | 5 +++++ src/components/Notifications/utils.tsx | 15 ++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/components/Notifications/NotificationsFeed.tsx b/src/components/Notifications/NotificationsFeed.tsx index 1f2b351b..e60f09f3 100644 --- a/src/components/Notifications/NotificationsFeed.tsx +++ b/src/components/Notifications/NotificationsFeed.tsx @@ -121,6 +121,11 @@ const NotificationHandler = ({ renderProfile?: (address: string) => JSX.Element | string | null }) => { const NotificationComponent = NotificationComponentByType[notification.type] + + if (!NotificationComponent) { + return null + } + return ( = { - [k in NotificationType]: T extends DCLNotification - ? // eslint-disable-next-line @typescript-eslint/no-explicit-any - FunctionComponent> - : never -} +export type DecentralandNotificationComponentByType = Partial< + { + [k in NotificationType]: T extends DCLNotification + ? // eslint-disable-next-line @typescript-eslint/no-explicit-any + FunctionComponent> + : never + } +> export const NotificationComponentByType: DecentralandNotificationComponentByType = { @@ -101,7 +103,6 @@ export const NotificationComponentByType: DecentralandNotificationComponentByTyp CampaignOutOfStockNotification, [NotificationType.REWARD_CAMPAIGN_GAS_PRICE_HIGHER_THAN_EXPECTED]: CampaignGasPriceHigherThanExpectedNotification, - [NotificationType.BADGE_GRANTED]: null, [NotificationType.EVENTS_STARTS_SOON]: EventsStartsSoonNotification, [NotificationType.EVENTS_STARTED]: EventsStartedNotification, [NotificationType.WORLDS_PERMISSION_GRANTED]: