fix(auth): prevent flash of login screen by maintaining loading state while resolving post-auth dashboard routing
This commit is contained in:
@@ -12,9 +12,11 @@ function AuthFlowInner({ mode }: { mode: "signin" | "signup" }) {
|
||||
|
||||
const [ssoProcessing, setSsoProcessing] = React.useState(false);
|
||||
const [ssoToken, setSsoToken] = React.useState<string | null>(null);
|
||||
const [routing, setRouting] = React.useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (status === "authenticated" && session?.user?.email) {
|
||||
setRouting(true);
|
||||
const isVibnCodeSSO = searchParams?.get("vibncode") === "true";
|
||||
|
||||
if (isVibnCodeSSO) {
|
||||
@@ -65,7 +67,7 @@ function AuthFlowInner({ mode }: { mode: "signin" | "signup" }) {
|
||||
}
|
||||
}, [status, session, router, searchParams]);
|
||||
|
||||
if (status === "loading" || ssoProcessing) {
|
||||
if (status === "loading" || ssoProcessing || routing) {
|
||||
return (
|
||||
<div
|
||||
className="new-site-wrapper"
|
||||
|
||||
Reference in New Issue
Block a user