Skip to content

Commit

Permalink
fix: handle missing profileData
Browse files Browse the repository at this point in the history
  • Loading branch information
hlolli committed Sep 14, 2024
1 parent 2399895 commit e082b09
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/components/login/subscribers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ export const subscribeToLoggedInUserProfile = (
const unsubscribe: () => void = onSnapshot(
doc(profiles, userUid),
(profile) => {
const profileData: any = profile.data();
const profileData = profile.data();
if (!profileData) {
console.error("No profile data found for user", {
userUid,
profile
});
return;
}
if (typeof profileData.userJoinDate === "object") {
profileData.userJoinDate = profileData.userJoinDate.toMillis();
}
Expand Down

0 comments on commit e082b09

Please sign in to comment.