completionId: cgen-fcdf2289a18c443ca98f91cf088d61e2
cgen-fcdf2289a18c443ca98f91cf088d61e2
This commit is contained in:
parent
4e65bdaed5
commit
c619ef3a92
1 changed files with 2 additions and 2 deletions
|
|
@ -298,10 +298,10 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
|
||||||
userId: string,
|
userId: string,
|
||||||
): Promise<AethexUserProfile | null> => {
|
): Promise<AethexUserProfile | null> => {
|
||||||
try {
|
try {
|
||||||
// Add 3-second timeout for profile fetch
|
// Add 8-second timeout for profile fetch (database can be slow)
|
||||||
const profilePromise = aethexUserService.getCurrentUser();
|
const profilePromise = aethexUserService.getCurrentUser();
|
||||||
const profileTimeoutPromise = new Promise<never>((_, reject) =>
|
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]);
|
const userProfile = await Promise.race([profilePromise, profileTimeoutPromise]);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue