Guard render against premature redirect; show nothing only when redirecting condition met

cgen-0f1c083ad7784113b586659a13c98789
This commit is contained in:
Builder.io 2025-09-27 20:45:16 +00:00
parent dfebb544cf
commit d9d1e1ae44

View file

@ -154,13 +154,8 @@ export default function Dashboard() {
}
};
// Don't show loading screen if no user - just redirect
if (!user) {
return null;
}
// Show loading only if we have a user but are still loading data
if (authLoading || isLoading) {
// While auth is resolving or data is loading, show loading screen
if (authLoading || isLoading || !user) {
return (
<LoadingScreen
message="Loading your dashboard..."