Skip to content

Commit

Permalink
Fix frontend exception when announcement not set
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewelwell committed Jul 12, 2024
1 parent b32a6ca commit ba39595
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion frontend/web/components/Announcement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ const Announcement: FC<AnnouncementType> = () => {
}

const announcementValue = Utils.getFlagsmithJSONValue('announcement', null)

if (!announcementValue) {
return null
}

const { buttonText, description, id, isClosable, title, url } =
announcementValue as AnnouncementValueType
const dismissed = flagsmith.getTrait('dismissed_announcement')

const dismissed = flagsmith.getTrait('dismissed_announcement')
const showBanner =
announcementValue &&
(!dismissed || dismissed !== announcementValue.id) &&
Expand Down

0 comments on commit ba39595

Please sign in to comment.