From 54130a56def921abcfc51e3202d7da83528004b8 Mon Sep 17 00:00:00 2001 From: Andrii Podriez Date: Wed, 25 Sep 2024 00:35:43 +0200 Subject: [PATCH] fixed an issue with notification system not being referenced correctly Signed-off-by: Andrii Podriez --- src/app.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/app.js b/src/app.js index 9456c32..15d512b 100644 --- a/src/app.js +++ b/src/app.js @@ -16,6 +16,7 @@ ******************************************************************************/ import React from 'react'; +import { useRef, useEffect } from 'react'; import { DndProvider } from 'react-dnd'; import { HTML5Backend }from 'react-dnd-html5-backend'; import NotificationSystem from 'react-notification-system'; @@ -49,19 +50,28 @@ const App = () => { return decodedToken.exp < timeNow; } + const notificationSystem = useRef(null); + + useEffect(() => { + NotificationsDataManager.setSystem(notificationSystem.current); + + return () => { + NotificationsDataManager.setSystem(null); + }; + }, []); + const { isAuthenticated, token, user } = useSelector((state) => state.auth); if (!isAuthenticated || isTokenExpired(token)) { console.log("APP redirecting to logout/login"); return (); } else { - console.log("APP rendering app"); const pages = branding.values.pages; return (
- +