diff --git a/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx b/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx index 80861eb16dfb..cd1b35c21a44 100644 --- a/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx +++ b/src/components/ValidateCodeActionModal/ValidateCodeForm/BaseValidateCodeForm.tsx @@ -102,6 +102,7 @@ function BaseValidateCodeForm({ const focusTimeoutRef = useRef(null); const [timeRemaining, setTimeRemaining] = useState(CONST.REQUEST_CODE_DELAY as number); const [canShowError, setCanShowError] = useState(false); + const latestActionVerifiedError = getLatestErrorField(validateCodeAction, 'actionVerified'); const timerRef = useRef(); @@ -184,12 +185,12 @@ function BaseValidateCodeForm({ setValidateCode(text); setFormError({}); - if (!isEmptyObject(validateError)) { + if (!isEmptyObject(validateError) || !isEmptyObject(latestActionVerifiedError)) { clearError(); clearValidateCodeActionError('actionVerified'); } }, - [validateError, clearError], + [validateError, clearError, latestActionVerifiedError], ); /** @@ -243,7 +244,7 @@ function BaseValidateCodeForm({ )} clearValidateCodeActionError('actionVerified')} >