completionId: cgen-265ec82eefda428d91889ceaf735a0fb

cgen-265ec82eefda428d91889ceaf735a0fb
This commit is contained in:
Builder.io 2025-11-05 06:59:25 +00:00
parent 048b501750
commit 9c87fb3341

View file

@ -298,13 +298,8 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
userId: string,
): Promise<AethexUserProfile | null> => {
try {
// Add 8-second timeout for profile fetch (database can be slow)
const profilePromise = aethexUserService.getCurrentUser();
const profileTimeoutPromise = new Promise<never>((_, reject) =>
setTimeout(() => reject(new Error("Profile fetch timeout")), 8000),
);
const userProfile = await Promise.race([profilePromise, profileTimeoutPromise]);
// Fetch user profile - let errors happen naturally rather than with aggressive timeouts
const userProfile = await aethexUserService.getCurrentUser();
setProfile(userProfile);
// Fetch roles in parallel (non-blocking) - don't await here