Fix sign in/useEffect usage

This commit is contained in:
Sam Becker 2025-04-22 09:14:13 -05:00
parent 64edb8581a
commit 9666d7deb2

View File

@ -49,12 +49,15 @@ export default function SignInForm({
if (response === KEY_CREDENTIALS_SUCCESS) {
setUserEmail?.(email);
}
}, [setUserEmail, response, email]);
useEffect(() => {
return () => {
// Capture user email before unmounting
getAuthAction().then(auth =>
setUserEmail?.(auth?.user?.email ?? undefined));
};
}, [setUserEmail, response, email]);
}, [setUserEmail]);
const isFormValid =
email.length > 0 &&