From 3fa56548e32d5e9ace8c48d1016fd292e5cdf736 Mon Sep 17 00:00:00 2001 From: binamkayastha Date: Mon, 22 Jul 2024 02:07:09 -0400 Subject: [PATCH] Only update streak if user exists --- nepalingo-web/src/hooks/StreakContext.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nepalingo-web/src/hooks/StreakContext.tsx b/nepalingo-web/src/hooks/StreakContext.tsx index 236b7e9..19121fb 100644 --- a/nepalingo-web/src/hooks/StreakContext.tsx +++ b/nepalingo-web/src/hooks/StreakContext.tsx @@ -50,7 +50,9 @@ export const StreakProvider = ({ children }: { children: ReactNode }) => { }; useEffect(() => { - updateStreakState(); + if (user) { + updateStreakState(); + } }, [user]); const updateStreak = async () => {