fix: add conditional to useEffects

This commit is contained in:
Lucas Smith
2024-03-11 10:55:46 +11:00
committed by GitHub
parent afe99e5ec9
commit c744482b84
2 changed files with 8 additions and 4 deletions

View File

@ -150,8 +150,10 @@ export const EnableAuthenticatorAppDialog = ({
}; };
useEffect(() => { useEffect(() => {
// Reset the form when the Dialog open state changes // Reset the form when the Dialog closes
if (!open) {
setupTwoFactorAuthenticationForm.reset(); setupTwoFactorAuthenticationForm.reset();
}
}, [open, setupTwoFactorAuthenticationForm]); }, [open, setupTwoFactorAuthenticationForm]);
return ( return (

View File

@ -93,8 +93,10 @@ export const ViewRecoveryCodesDialog = ({ open, onOpenChange }: ViewRecoveryCode
}; };
useEffect(() => { useEffect(() => {
// Reset the form when the Dialog open state changes // Reset the form when the Dialog closes
if (!open) {
viewRecoveryCodesForm.reset(); viewRecoveryCodesForm.reset();
}
}, [open, viewRecoveryCodesForm]); }, [open, viewRecoveryCodesForm]);
return ( return (