Simplify the loading state check to avoid getting stuck
cgen-6183cca4bf6c427381c3a3a7ec07fd34
This commit is contained in:
parent
8bf8ac94a2
commit
09ce29f2a1
1 changed files with 10 additions and 5 deletions
|
|
@ -132,19 +132,24 @@ export default function Dashboard() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Return early if auth is still loading
|
// Don't show loading screen if no user - just redirect
|
||||||
if (authLoading) {
|
if (!user) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Show loading only if we have a user but are still loading data
|
||||||
|
if (authLoading || isLoading) {
|
||||||
return (
|
return (
|
||||||
<LoadingScreen
|
<LoadingScreen
|
||||||
message="Loading your dashboard..."
|
message="Loading your dashboard..."
|
||||||
showProgress={true}
|
showProgress={true}
|
||||||
duration={2000}
|
duration={1500}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If auth is complete but no user, the useEffect will handle redirect
|
// Don't render if no profile
|
||||||
if (!user || !profile) {
|
if (!profile) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue