Skip to content

Commit 7fe3da2

Browse files
author
Boopathi
committed
Fix: Move all useState hooks to top level in ActionHandlerContent to comply with React rules of hooks
1 parent 88815c0 commit 7fe3da2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/app/auth/action/page.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ const ActionHandlerContent: React.FC = () => {
115115
const [info, setInfo] = React.useState<{ email: string; from: 'verifyEmail' | 'resetPassword' } | null>(null);
116116
const [success, setSuccess] = React.useState(false);
117117
const [redirecting, setRedirecting] = React.useState(false);
118+
// Moved up: fallback email verification check states
119+
const [showCheckVerification, setShowCheckVerification] = React.useState(false);
120+
const [checkEmail, setCheckEmail] = React.useState("");
121+
const [checking, setChecking] = React.useState(false);
122+
const [checkResult, setCheckResult] = React.useState<null | "verified" | "not_verified" | "error">(null);
123+
const [checkError, setCheckError] = React.useState("");
118124

119125
const form = useForm<PasswordResetValues>({
120126
resolver: zodResolver(passwordResetSchema),
@@ -316,12 +322,6 @@ const ActionHandlerContent: React.FC = () => {
316322
}
317323

318324
// Fallback for any other state
319-
const [showCheckVerification, setShowCheckVerification] = React.useState(false);
320-
const [checkEmail, setCheckEmail] = React.useState("");
321-
const [checking, setChecking] = React.useState(false);
322-
const [checkResult, setCheckResult] = React.useState<null | "verified" | "not_verified" | "error">(null);
323-
const [checkError, setCheckError] = React.useState("");
324-
325325
if (showCheckVerification) {
326326
return (
327327
<div className="text-center">

0 commit comments

Comments
 (0)