Skip to content

Commit

Permalink
fix: unsubscribe user
Browse files Browse the repository at this point in the history
  • Loading branch information
eldu committed Apr 16, 2024
1 parent 2ed0d56 commit 67d3c4b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/utils/firebase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,9 @@ export const useAuthStateChanged = () => {
const unsubscribeUser = onSnapshot(doc(db, usersCollection, email), (doc) => {
if (doc.exists) {
dispatch(setUserState(doc.data()));
return;
}
});
unsubscribeUser();
return () => unsubscribeUser();
} else {
dispatch(setUserState(null));
}
Expand Down

0 comments on commit 67d3c4b

Please sign in to comment.