From e082b0997013a5a02d29f2b19294acf1da071287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hl=C3=B6=C3=B0ver=20Sigur=C3=B0sson?= Date: Sat, 14 Sep 2024 16:57:45 +0300 Subject: [PATCH] fix: handle missing profileData --- src/components/login/subscribers.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/login/subscribers.tsx b/src/components/login/subscribers.tsx index 27dc8421..8fc1b6c3 100644 --- a/src/components/login/subscribers.tsx +++ b/src/components/login/subscribers.tsx @@ -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(); }