From 6abe1e6ba9cdc2730510bbfd8adf0325667175f7 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Fri, 16 Jun 2023 13:11:55 -0300 Subject: [PATCH] fix(alertContext.tsx): prevent empty titles from being added to notification center in setErrorData, setNoticeData and setSuccessData functions --- src/frontend/src/contexts/alertContext.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/contexts/alertContext.tsx b/src/frontend/src/contexts/alertContext.tsx index f85f858de..ed31c03a9 100644 --- a/src/frontend/src/contexts/alertContext.tsx +++ b/src/frontend/src/contexts/alertContext.tsx @@ -80,7 +80,7 @@ export function AlertProvider({ children }: { children: ReactNode }) { function setErrorData(newState: { title: string; list?: Array }) { setErrorDataState(newState); setErrorOpen(true); - if (newState.title) { + if (newState.title && newState.title !== "") { setNotificationCenter(true); pushNotificationList({ type: "error", @@ -97,7 +97,7 @@ export function AlertProvider({ children }: { children: ReactNode }) { function setNoticeData(newState: { title: string; link?: string }) { setNoticeDataState(newState); setNoticeOpen(true); - if (newState.title) { + if (newState.title && newState.title !== "") { // Add new notice to notification center setNotificationCenter(true); pushNotificationList({ @@ -117,7 +117,7 @@ export function AlertProvider({ children }: { children: ReactNode }) { setSuccessOpen(true); // open the success alert // If the new state has a "title" property, add a new success notification to the list - if (newState.title) { + if (newState.title && newState.title !== "") { setNotificationCenter(true); // show the notification center pushNotificationList({ // add the new notification to the list