From bb343cea9d6d49437d259c78488aeda5cb97c561 Mon Sep 17 00:00:00 2001 From: suren-atoyan Date: Wed, 3 Jan 2024 20:26:18 +0400 Subject: [PATCH] check if message exists --- .../Notifications/Notifier/Notifier.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/sections/Notifications/Notifier/Notifier.tsx b/src/sections/Notifications/Notifier/Notifier.tsx index b5cae68..c2632d8 100644 --- a/src/sections/Notifications/Notifier/Notifier.tsx +++ b/src/sections/Notifications/Notifier/Notifier.tsx @@ -32,14 +32,16 @@ function Notifier() { if (options.key && displayed.current.includes(options.key)) return; // display snackbar using notistack - enqueueSnackbar(message, { - ...options, - onExited(event, key) { - // removen this snackbar from the store - actions.remove(key); - removeDisplayed(key); - }, - }); + if (message) { + enqueueSnackbar(message, { + ...options, + onExited(event, key) { + // removen this snackbar from the store + actions.remove(key); + removeDisplayed(key); + }, + }); + } // keep track of snackbars that we've displayed options.key && storeDisplayed(options.key);