From 4d02e0b3804e8f50d46e299d5b7c12851a491a12 Mon Sep 17 00:00:00 2001 From: daledah Date: Thu, 3 Oct 2024 23:49:53 +0700 Subject: [PATCH 1/2] fix: error not shown, redirect incorrectly on add bank account --- .../ValidateCodeForm/BaseValidateCodeForm.tsx | 5 +---- src/pages/AddPersonalBankAccountPage.tsx | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx b/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx index 1716249c597..104b865bac4 100644 --- a/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx +++ b/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx @@ -126,12 +126,9 @@ function BaseValidateCodeForm({ ); useEffect(() => { - if (!validateError) { - return; - } clearError(); // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps - }, [clearError, validateError]); + }, []); useEffect(() => { if (!hasMagicCodeBeenSent) { diff --git a/src/pages/AddPersonalBankAccountPage.tsx b/src/pages/AddPersonalBankAccountPage.tsx index 24faf40b63f..fdc200f45ad 100644 --- a/src/pages/AddPersonalBankAccountPage.tsx +++ b/src/pages/AddPersonalBankAccountPage.tsx @@ -45,7 +45,7 @@ function AddPersonalBankAccountPage() { } else if (shouldContinue && onSuccessFallbackRoute) { PaymentMethods.continueSetup(onSuccessFallbackRoute); } else { - Navigation.goBack(); + Navigation.navigate(ROUTES.SETTINGS_WALLET); } }, [personalBankAccount], From 392d5d7da1efe4568c345f7d7feed83e0e7efdd9 Mon Sep 17 00:00:00 2001 From: daledah Date: Fri, 4 Oct 2024 00:41:48 +0700 Subject: [PATCH 2/2] fix: remove eslint disable line --- .../ValidateCodeForm/BaseValidateCodeForm.tsx | 3 +-- src/pages/settings/Wallet/VerifyAccountPage.tsx | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx b/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx index 104b865bac4..f71b957387a 100644 --- a/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx +++ b/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx @@ -127,8 +127,7 @@ function BaseValidateCodeForm({ useEffect(() => { clearError(); - // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps - }, []); + }, [clearError]); useEffect(() => { if (!hasMagicCodeBeenSent) { diff --git a/src/pages/settings/Wallet/VerifyAccountPage.tsx b/src/pages/settings/Wallet/VerifyAccountPage.tsx index 1fb39304ec4..e375f03ba58 100644 --- a/src/pages/settings/Wallet/VerifyAccountPage.tsx +++ b/src/pages/settings/Wallet/VerifyAccountPage.tsx @@ -49,6 +49,10 @@ function VerifyAccountPage({route}: VerifyAccountPageProps) { [loginList, contactMethod], ); + const clearError = useCallback(() => { + User.clearContactMethodErrors(contactMethod, 'validateLogin'); + }, [contactMethod]); + useEffect(() => { if (!isUserValidated) { return; @@ -73,7 +77,7 @@ function VerifyAccountPage({route}: VerifyAccountPageProps) { validateCodeAction={validateCodeAction} validateError={validateLoginError} handleSubmitForm={handleSubmitForm} - clearError={() => User.clearContactMethodErrors(contactMethod, 'validateLogin')} + clearError={clearError} buttonStyles={[styles.justifyContentEnd, styles.flex1, safePaddingBottomStyle]} />