Add additional safety check with window navigation for stuck states

cgen-67c5fbd50a11488aa8879c547d0968e1
This commit is contained in:
Builder.io 2025-08-08 10:17:57 +00:00
parent 09ce29f2a1
commit c89fef26c6

View file

@ -58,7 +58,14 @@ export default function Dashboard() {
// Force redirect immediately if no user
if (!user) {
setIsLoading(false);
// Use both React Router and window location as fallback
navigate("/login", { replace: true });
// Fallback in case React Router fails
setTimeout(() => {
if (!user) {
window.location.href = "/login";
}
}, 500);
return;
}