Skip to content

Commit 6b8db3f

Browse files
authored
Merge pull request #177 from Piyush-Deshmukh/patch-4
Fix: `Home.jsx` and `Library.jsx` useEffect hook missing dependency issue
2 parents dc1c044 + 71eff6a commit 6b8db3f

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/components/Library/Library.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ export default function Library({ filter, setFilter }) {
337337
setMyRows([]);
338338
setFilter('');
339339
};
340-
}, [filter, myRows]);
340+
}, [setFilter, filter, myRows]);
341341

342342
useEffect(() => {
343343
fetchBooksFromDB();

src/pages/Home/Home.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function Home() {
7676
}
7777
hasRun.current = true; //Toggle hasRun to true to prevent useEffect from running twice
7878
}
79-
}, []);
79+
}, [location.state]);
8080

8181
const matches = useMediaQuery('(max-width:700px)');
8282
return (

0 commit comments

Comments
 (0)