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(() => {
// Reset the form when the Dialog open state changes
setupTwoFactorAuthenticationForm.reset();
// Reset the form when the Dialog closes
if (!open) {
setupTwoFactorAuthenticationForm.reset();
}
}, [open, setupTwoFactorAuthenticationForm]);
return (

View File

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