From d608c8ea789bc349366726fb7cc646da5e3b0991 Mon Sep 17 00:00:00 2001 From: Marshall Polaris Date: Fri, 2 Sep 2022 14:02:37 -0700 Subject: [PATCH] Only set referral info on user after creation --- web/components/auth-context.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/components/auth-context.tsx b/web/components/auth-context.tsx index 3c09ccdb..c1721ff5 100644 --- a/web/components/auth-context.tsx +++ b/web/components/auth-context.tsx @@ -77,12 +77,12 @@ export function AuthProvider(props: { if (!current.user || !current.privateUser) { const deviceToken = ensureDeviceToken() current = (await createUser({ deviceToken })) as UserAndPrivateUser + setCachedReferralInfoForUser(current.user) } setAuthUser(current) // Persist to local storage, to reduce login blink next time. // Note: Cap on localStorage size is ~5mb localStorage.setItem(CACHED_USER_KEY, JSON.stringify(current)) - setCachedReferralInfoForUser(current.user) } else { // User logged out; reset to null setUserCookie(undefined)