From 7b95fd7b003f0253b9228e265a76dff521c22a13 Mon Sep 17 00:00:00 2001 From: Eskalifer1 Date: Tue, 26 Aug 2025 12:33:38 +0300 Subject: [PATCH] fix:68830: clear error on BA confirmation step --- .../substeps/Confirmation.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/pages/settings/Wallet/InternationalDepositAccount/substeps/Confirmation.tsx b/src/pages/settings/Wallet/InternationalDepositAccount/substeps/Confirmation.tsx index cc16a96be992..858e6c012842 100644 --- a/src/pages/settings/Wallet/InternationalDepositAccount/substeps/Confirmation.tsx +++ b/src/pages/settings/Wallet/InternationalDepositAccount/substeps/Confirmation.tsx @@ -15,7 +15,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import {getCurrencySymbol} from '@libs/CurrencyUtils'; import {getLatestErrorMessage} from '@libs/ErrorUtils'; import type CustomSubStepProps from '@pages/settings/Wallet/InternationalDepositAccount/types'; -import {clearReimbursementAccountBankCreation, createCorpayBankAccountForWalletFlow} from '@userActions/BankAccounts'; +import {clearReimbursementAccountBankCreation, createCorpayBankAccountForWalletFlow, hideBankAccountErrors} from '@userActions/BankAccounts'; import CONST from '@src/CONST'; import type {TranslationPaths} from '@src/languages/types'; import ONYXKEYS from '@src/ONYXKEYS'; @@ -76,6 +76,17 @@ function Confirmation({onNext, onMove, formValues, fieldsMap}: CustomSubStepProp } }, [reimbursementAccount?.isLoading, reimbursementAccount?.isSuccess, reimbursementAccount?.errors, onNext]); + // We want to clear errors every time we leave this page. + // Therefore, we use useEffect, which clears errors when unmounted. + // This is necessary so that when we close the BA flow or move on to another step, the error is cleared. + // Additionally, we add error clearing to useEffect itself so that errors are cleared if this page opens after reloading. + useEffect(() => { + hideBankAccountErrors(); + return () => { + hideBankAccountErrors(); + }; + }, []); + const summaryItems: MenuItemProps[] = [ { description: translate('common.country'),