Skip to content

Commit

Permalink
avoid massive logouts
Browse files Browse the repository at this point in the history
  • Loading branch information
H34D committed Mar 7, 2023
1 parent b9ee2fc commit fa2a7af
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/provider/modules/session/session.ts
Expand Up @@ -74,10 +74,14 @@ export const useSession = (
}, [masa, clearSession]);

useEffect(() => {
if (sessionData && sessionData.user.address !== walletAddress) {
if (
isLoggedIn &&
sessionData &&
sessionData.user.address !== walletAddress
) {
void handleLogout();
}
}, [sessionData, walletAddress, handleLogout]);
}, [sessionData, walletAddress, handleLogout, isLoggedIn]);

return {
isLoggedIn,
Expand Down

0 comments on commit fa2a7af

Please sign in to comment.