completionId: cgen-fcdf2289a18c443ca98f91cf088d61e2

cgen-fcdf2289a18c443ca98f91cf088d61e2
This commit is contained in:
Builder.io 2025-11-05 06:44:22 +00:00
parent 4e65bdaed5
commit c619ef3a92

View file

@ -298,10 +298,10 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
userId: string,
): Promise<AethexUserProfile | null> => {
try {
// Add 3-second timeout for profile fetch
// 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")), 3000),
setTimeout(() => reject(new Error("Profile fetch timeout")), 8000),
);
const userProfile = await Promise.race([profilePromise, profileTimeoutPromise]);