From 71eff6a7550001ff00f53c0c9faf4c22d89fdcd9 Mon Sep 17 00:00:00 2001 From: Piyush Deshmukh <99667276+Piyush-Deshmukh@users.noreply.github.com> Date: Fri, 15 Sep 2023 19:57:19 +0530 Subject: [PATCH] Fix: Home.jsx and Library.jsx useEffect hook issue --- src/components/Library/Library.jsx | 2 +- src/pages/Home/Home.jsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Library/Library.jsx b/src/components/Library/Library.jsx index 2435b13..8afca61 100644 --- a/src/components/Library/Library.jsx +++ b/src/components/Library/Library.jsx @@ -337,7 +337,7 @@ export default function Library({ filter, setFilter }) { setMyRows([]); setFilter(''); }; - }, [filter, myRows]); + }, [setFilter, filter, myRows]); useEffect(() => { fetchBooksFromDB(); diff --git a/src/pages/Home/Home.jsx b/src/pages/Home/Home.jsx index 2f5afbb..624bb9e 100644 --- a/src/pages/Home/Home.jsx +++ b/src/pages/Home/Home.jsx @@ -76,7 +76,7 @@ function Home() { } hasRun.current = true; //Toggle hasRun to true to prevent useEffect from running twice } - }, []); + }, [location.state]); const matches = useMediaQuery('(max-width:700px)'); return (