Skip to content

Commit be8cbbe

Browse files
authored
Merge pull request #111 from MODSetter/dev
fix: Added Suspense boundary in Login Page
2 parents 94c7913 + 604791e commit be8cbbe

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

surfsense_web/app/login/page.tsx

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"use client";
22

3-
import { useState, useEffect } from "react";
3+
import { useState, useEffect, Suspense } from "react";
44
import { GoogleLoginButton } from "./GoogleLoginButton";
55
import { LocalLoginForm } from "./LocalLoginForm";
66
import { Logo } from "@/components/Logo";
77
import { AmbientBackground } from "./AmbientBackground";
88
import { useSearchParams } from "next/navigation";
99
import { Loader2 } from "lucide-react";
1010

11-
export default function LoginPage() {
11+
function LoginContent() {
1212
const [authType, setAuthType] = useState<string | null>(null);
1313
const [registrationSuccess, setRegistrationSuccess] = useState(false);
1414
const [isLoading, setIsLoading] = useState(true);
@@ -64,4 +64,26 @@ export default function LoginPage() {
6464
</div>
6565
</div>
6666
);
67+
}
68+
69+
// Loading fallback for Suspense
70+
const LoadingFallback = () => (
71+
<div className="relative w-full overflow-hidden">
72+
<AmbientBackground />
73+
<div className="mx-auto flex h-screen max-w-lg flex-col items-center justify-center">
74+
<Logo className="rounded-md" />
75+
<div className="mt-8 flex items-center space-x-2">
76+
<Loader2 className="h-5 w-5 animate-spin text-muted-foreground" />
77+
<span className="text-muted-foreground">Loading...</span>
78+
</div>
79+
</div>
80+
</div>
81+
);
82+
83+
export default function LoginPage() {
84+
return (
85+
<Suspense fallback={<LoadingFallback />}>
86+
<LoginContent />
87+
</Suspense>
88+
);
6789
}

0 commit comments

Comments
 (0)