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