From 6105523680ed92c96a5f2275083eb582e026eea7 Mon Sep 17 00:00:00 2001 From: Pavlo Tsimura Date: Tue, 12 Dec 2023 20:49:14 +0100 Subject: [PATCH 1/2] Show only input error if both are present --- src/pages/signin/LoginForm/BaseLoginForm.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/signin/LoginForm/BaseLoginForm.js b/src/pages/signin/LoginForm/BaseLoginForm.js index e7ac249582a9..af9fa98e7a81 100644 --- a/src/pages/signin/LoginForm/BaseLoginForm.js +++ b/src/pages/signin/LoginForm/BaseLoginForm.js @@ -239,7 +239,7 @@ function LoginForm(props) { const formErrorText = useMemo(() => (formError ? translate(formError) : ''), [formError, translate]); const serverErrorText = useMemo(() => ErrorUtils.getLatestErrorMessage(props.account), [props.account]); - const hasError = !_.isEmpty(serverErrorText); + const hasServerError = !_.isEmpty(serverErrorText) && _.isEmpty(formErrorText); return ( <> @@ -270,7 +270,7 @@ function LoginForm(props) { autoCorrect={false} inputMode={CONST.INPUT_MODE.EMAIL} errorText={formErrorText} - hasError={hasError} + hasError={hasServerError} maxLength={CONST.LOGIN_CHARACTER_LIMIT} /> @@ -287,14 +287,14 @@ function LoginForm(props) { // We need to unmount the submit button when the component is not visible so that the Enter button // key handler gets unsubscribed props.isVisible && ( - + { From fcdafdfc241070c0a8311df3224220679792f714 Mon Sep 17 00:00:00 2001 From: Pavlo Tsimura Date: Thu, 14 Dec 2023 18:40:18 +0100 Subject: [PATCH 2/2] Rename variable to shouldShowServerError --- src/pages/signin/LoginForm/BaseLoginForm.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pages/signin/LoginForm/BaseLoginForm.js b/src/pages/signin/LoginForm/BaseLoginForm.js index af9fa98e7a81..f243e12170d8 100644 --- a/src/pages/signin/LoginForm/BaseLoginForm.js +++ b/src/pages/signin/LoginForm/BaseLoginForm.js @@ -52,7 +52,7 @@ const propTypes = { /** Success message to display when necessary */ success: PropTypes.string, - /** Whether or not a sign on form is loading (being submitted) */ + /** Whether a sign on form is loading (being submitted) */ isLoading: PropTypes.bool, }), @@ -239,7 +239,7 @@ function LoginForm(props) { const formErrorText = useMemo(() => (formError ? translate(formError) : ''), [formError, translate]); const serverErrorText = useMemo(() => ErrorUtils.getLatestErrorMessage(props.account), [props.account]); - const hasServerError = !_.isEmpty(serverErrorText) && _.isEmpty(formErrorText); + const shouldShowServerError = !_.isEmpty(serverErrorText) && _.isEmpty(formErrorText); return ( <> @@ -270,7 +270,7 @@ function LoginForm(props) { autoCorrect={false} inputMode={CONST.INPUT_MODE.EMAIL} errorText={formErrorText} - hasError={hasServerError} + hasError={shouldShowServerError} maxLength={CONST.LOGIN_CHARACTER_LIMIT} /> @@ -287,14 +287,14 @@ function LoginForm(props) { // We need to unmount the submit button when the component is not visible so that the Enter button // key handler gets unsubscribed props.isVisible && ( - + {