diff --git a/client/src/App/App.jsx b/client/src/App/App.jsx index 9243db625..dd695863c 100644 --- a/client/src/App/App.jsx +++ b/client/src/App/App.jsx @@ -63,16 +63,16 @@ export function App({bodyshop, checkUserSession, currentUser, online, setOnline} //const b = Grid.useBreakpoint(); // console.log("Breakpoints:", b); - const offlineListener = (e) => { - setOnline(false); - } - - const onlineListener = (e) => { - setOnline(true); - } - // Associate event listeners, memoize to prevent multiple listeners being added useEffect(() => { + const offlineListener = (e) => { + setOnline(false); + } + + const onlineListener = (e) => { + setOnline(true); + } + if (!listenersAdded) { console.log('Added events for offline and online'); window.addEventListener("offline", offlineListener); @@ -84,7 +84,7 @@ export function App({bodyshop, checkUserSession, currentUser, online, setOnline} window.removeEventListener("offline", offlineListener); window.removeEventListener("online", onlineListener); } - }, [listenersAdded]); + }, [setOnline, listenersAdded]); useEffect(() => { if (currentUser.authorized && bodyshop) { diff --git a/client/src/pages/manage/manage.page.component.jsx b/client/src/pages/manage/manage.page.component.jsx index f8268142b..f3c71bed2 100644 --- a/client/src/pages/manage/manage.page.component.jsx +++ b/client/src/pages/manage/manage.page.component.jsx @@ -177,7 +177,7 @@ const mapStateToProps = createStructuredSelector({ export function Manage({conflict, bodyshop}) { const {t} = useTranslation(); - const [chatVisible, setChatVisible] = useState(false); + const [chatVisible] = useState(false); useEffect(() => {