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