Skip to content

Commit fd6ddb8

Browse files
committed
fix: redirect users to login page during local development, preventing infinite loading.
1 parent 2476595 commit fd6ddb8

File tree

1 file changed

+9
-0
lines changed
  • packages/ai-workspace-common/src/components/home-redirect

1 file changed

+9
-0
lines changed

packages/ai-workspace-common/src/components/home-redirect/index.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ export const HomeRedirect = ({ defaultNode }: { defaultNode: ReactNode }) => {
1515
if (isLogin) {
1616
return <Navigate to={'/workspace'} replace />;
1717
}
18+
19+
// In local development (localhost), redirect to /login directly to avoid infinite loading
20+
const hostname = window.location.hostname;
21+
const isLocalhost = hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '::1';
22+
23+
if (isLocalhost) {
24+
return <Navigate to="/login" replace />;
25+
}
26+
1827
// Return defaultNode to allow server-side handling (e.g., Cloudflare Worker)
1928
// BackendRedirect will handle the redirect and avoid infinite loop
2029
return defaultNode;

0 commit comments

Comments
 (0)