()
| 53 | * This pre-fetches the email so getUser() can remain synchronous. |
| 54 | */ |
| 55 | export async function initUser(): Promise<void> { |
| 56 | if (cachedEmail === null && !emailFetchPromise) { |
| 57 | emailFetchPromise = getEmailAsync() |
| 58 | cachedEmail = await emailFetchPromise |
| 59 | emailFetchPromise = null |
| 60 | // Clear memoization cache so next call picks up the email |
| 61 | getCoreUserData.cache.clear?.() |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Reset all user data caches. Call on auth changes (login/logout/account switch) |
no test coverage detected