From 64682de1ff4bb10e32af5076a00116b12644e055 Mon Sep 17 00:00:00 2001 From: carllelandtaylor Date: Mon, 2 Sep 2024 10:24:45 -0700 Subject: [PATCH 1/2] [React][FrontDesk] Stop recreating login/notif callback every re nder --- frontend/src/FrontDesk.jsx | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/frontend/src/FrontDesk.jsx b/frontend/src/FrontDesk.jsx index 627c01ccfa..34d9b1370c 100644 --- a/frontend/src/FrontDesk.jsx +++ b/frontend/src/FrontDesk.jsx @@ -22,21 +22,6 @@ export default function FrontDesk() { ); const [loading, setLoading] = useState(true); - const checkLoginStatus = () => { - axios - .head("/api/v3/user") - .then((response) => { - setIsLoggedIn(response.status === 200); - setLoading(false); - }) - .catch((error) => { - console.log("Error", error); - setLoading(false); - setIsLoggedIn(false); - setError(error.response.status); - }); - }; - const getAllNotifications = async () => { const { collaborationTitle, collaborationData } = await getCollaborationNotifications(); @@ -49,6 +34,21 @@ export default function FrontDesk() { }; useEffect(() => { + const checkLoginStatus = () => { + axios + .head("/api/v3/user") + .then((response) => { + setIsLoggedIn(response.status === 200); + setLoading(false); + }) + .catch((error) => { + console.log("Error", error); + setLoading(false); + setIsLoggedIn(false); + setError(error.response.status); + }); + }; + getAllNotifications(); checkLoginStatus(); const intervalId = setInterval(() => { @@ -56,7 +56,7 @@ export default function FrontDesk() { }, 60000); return () => clearInterval(intervalId); - }, []); + }, [setError]); if (loading) return ; From ed5af5283bb6b359c1fd9cd581a5f18e8146d158 Mon Sep 17 00:00:00 2001 From: carllelandtaylor Date: Mon, 2 Sep 2024 11:36:40 -0700 Subject: [PATCH 2/2] [React][DataTable] Change number == checks to === --- frontend/src/components/DataTable.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/DataTable.jsx b/frontend/src/components/DataTable.jsx index dc2cc2219b..152cb4b80f 100644 --- a/frontend/src/components/DataTable.jsx +++ b/frontend/src/components/DataTable.jsx @@ -317,7 +317,7 @@ const MyDataTable = ({ value={filterText} onChange={handleFilterChange} /> - {filterText.length == 0 ? ( + {filterText.length === 0 ? (