completionId: cgen-265ec82eefda428d91889ceaf735a0fb
cgen-265ec82eefda428d91889ceaf735a0fb
This commit is contained in:
parent
048b501750
commit
9c87fb3341
1 changed files with 2 additions and 7 deletions
|
|
@ -298,13 +298,8 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
|
||||||
userId: string,
|
userId: string,
|
||||||
): Promise<AethexUserProfile | null> => {
|
): Promise<AethexUserProfile | null> => {
|
||||||
try {
|
try {
|
||||||
// Add 8-second timeout for profile fetch (database can be slow)
|
// Fetch user profile - let errors happen naturally rather than with aggressive timeouts
|
||||||
const profilePromise = aethexUserService.getCurrentUser();
|
const userProfile = await aethexUserService.getCurrentUser();
|
||||||
const profileTimeoutPromise = new Promise<never>((_, reject) =>
|
|
||||||
setTimeout(() => reject(new Error("Profile fetch timeout")), 8000),
|
|
||||||
);
|
|
||||||
|
|
||||||
const userProfile = await Promise.race([profilePromise, profileTimeoutPromise]);
|
|
||||||
setProfile(userProfile);
|
setProfile(userProfile);
|
||||||
|
|
||||||
// Fetch roles in parallel (non-blocking) - don't await here
|
// Fetch roles in parallel (non-blocking) - don't await here
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue