diff --git a/web/components/auth-context.tsx b/web/components/auth-context.tsx index 19ced0b2..223fe123 100644 --- a/web/components/auth-context.tsx +++ b/web/components/auth-context.tsx @@ -68,11 +68,11 @@ export function AuthProvider(props: { }, [setAuthUser, serverUser]) useEffect(() => { - if (authUser != null) { + if (authUser) { // Persist to local storage, to reduce login blink next time. // Note: Cap on localStorage size is ~5mb localStorage.setItem(CACHED_USER_KEY, JSON.stringify(authUser)) - } else { + } else if (authUser === null) { localStorage.removeItem(CACHED_USER_KEY) } }, [authUser])