Force loading to false after timeout, regardless of fetchUserProfile state
cgen-fc94b84d308e41afbb64105f43788e13
This commit is contained in:
parent
b829a50cc7
commit
2e5563fe59
1 changed files with 8 additions and 2 deletions
|
|
@ -339,11 +339,17 @@ export const AuthProvider: React.FC<{ children: React.ReactNode }> = ({
|
|||
});
|
||||
|
||||
// Don't wait for rolesPromise - continue immediately
|
||||
setLoading(false);
|
||||
// Always set loading to false, even if role fetching hasn't completed
|
||||
setTimeout(() => {
|
||||
setLoading(false);
|
||||
}, 100);
|
||||
return userProfile;
|
||||
} catch (error) {
|
||||
console.error("Error fetching user profile:", error);
|
||||
setLoading(false);
|
||||
// Always set loading to false even on error
|
||||
setTimeout(() => {
|
||||
setLoading(false);
|
||||
}, 100);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue