Skip to content

Commit

Permalink
fix: add condition on useEffects to block infinity loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Valimp committed Oct 28, 2024
1 parent 26e7872 commit 70fabe5
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,15 @@ export default function App() {
return isLoggedIn;
}, [userState]);

useEffect(() => {
console.log("User state changed");
}, [userState]);
if(!devMode) {
useEffect(() => {
console.log("User state changed");
}, [userState]);

useEffect(() => {
refresh();
}, [refresh]);
useEffect(() => {
refresh();
}, [refresh]);
}

return (
<LoginContext.Provider value={{ ...userState, refresh }}>
Expand Down

0 comments on commit 70fabe5

Please sign in to comment.