From 45ea56f3326c672f1e722fa1a72492daf24b524a Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Wed, 15 Sep 2021 23:59:53 +0530 Subject: [PATCH 1/3] fix: lag between language switch on login page --- src/libs/actions/Session.js | 11 +++++++++++ src/pages/signin/ChangeExpensifyLoginLink.js | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/libs/actions/Session.js b/src/libs/actions/Session.js index e49e4d9b000c..0546ff3dda38 100644 --- a/src/libs/actions/Session.js +++ b/src/libs/actions/Session.js @@ -298,6 +298,16 @@ function continueSessionFromECom(accountID, validateCode, twoFactorAuthCode) { }); } +/** + * Clear the creadentials and partial sign in session so the user can taken back to first Login step + */ +function clearSignInData() { + Onyx.multiSet({ + [ONYXKEYS.ACCOUNT]: null, + [ONYXKEYS.CREDENTIALS]: null, + }); +} + export { continueSessionFromECom, fetchAccountDetails, @@ -307,4 +317,5 @@ export { reopenAccount, resendValidationLink, resetPassword, + clearSignInData, }; diff --git a/src/pages/signin/ChangeExpensifyLoginLink.js b/src/pages/signin/ChangeExpensifyLoginLink.js index 4fe1741e2f94..a8d3d16be345 100755 --- a/src/pages/signin/ChangeExpensifyLoginLink.js +++ b/src/pages/signin/ChangeExpensifyLoginLink.js @@ -5,11 +5,11 @@ import PropTypes from 'prop-types'; import Str from 'expensify-common/lib/str'; import Text from '../../components/Text'; import styles from '../../styles/styles'; -import redirectToSignIn from '../../libs/actions/SignInRedirect'; import themeColors from '../../styles/themes/default'; import ONYXKEYS from '../../ONYXKEYS'; import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize'; import compose from '../../libs/compose'; +import {clearSignInData} from '../../libs/actions/Session'; const propTypes = { /** The credentials of the logged in person */ @@ -33,7 +33,7 @@ const ChangeExpensifyLoginLink = ({credentials, translate, toLocalPhone}) => ( redirectToSignIn()} + onPress={clearSignInData} underlayColor={themeColors.componentBG} > From d09d16b9e1f5a1bc9ca46d17f70f7835f364ba85 Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Thu, 16 Sep 2021 00:00:58 +0530 Subject: [PATCH 2/3] remove unused prop --- src/pages/signin/SignInPage.js | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/pages/signin/SignInPage.js b/src/pages/signin/SignInPage.js index ce47478da5d3..9c49644fb817 100644 --- a/src/pages/signin/SignInPage.js +++ b/src/pages/signin/SignInPage.js @@ -39,18 +39,11 @@ const propTypes = { twoFactorAuthCode: PropTypes.string, }), - /** The session of the logged in person */ - session: PropTypes.shape({ - /** Error to display when there is a session error returned */ - authToken: PropTypes.string, - }), - ...withLocalizePropTypes, }; const defaultProps = { account: {}, - session: {}, credentials: {}, }; @@ -115,6 +108,5 @@ export default compose( withOnyx({ account: {key: ONYXKEYS.ACCOUNT}, credentials: {key: ONYXKEYS.CREDENTIALS}, - session: {key: ONYXKEYS.SESSION}, }), )(SignInPage); From 28d36a4a038010162bce4b5a3fb3898053831c34 Mon Sep 17 00:00:00 2001 From: Rajat Parashar Date: Fri, 17 Sep 2021 17:19:20 +0530 Subject: [PATCH 3/3] typo --- src/libs/actions/Session.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/actions/Session.js b/src/libs/actions/Session.js index 0546ff3dda38..9b9227229adb 100644 --- a/src/libs/actions/Session.js +++ b/src/libs/actions/Session.js @@ -299,7 +299,7 @@ function continueSessionFromECom(accountID, validateCode, twoFactorAuthCode) { } /** - * Clear the creadentials and partial sign in session so the user can taken back to first Login step + * Clear the credentials and partial sign in session so the user can taken back to first Login step */ function clearSignInData() { Onyx.multiSet({