Skip to content

Commit

Permalink
Merge pull request #5300 from parasharrajat/picker-lag
Browse files Browse the repository at this point in the history
fix: lag between language switch on login page
  • Loading branch information
Julesssss authored Oct 18, 2021
2 parents 7cd3bdb + 7e1221e commit 61bbde6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
11 changes: 11 additions & 0 deletions src/libs/actions/Session.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,16 @@ function continueSessionFromECom(accountID, validateCode, twoFactorAuthCode) {
});
}

/**
* Clear the credentials 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,
});
}

/**
* Put any logic that needs to run when we are signed out here. This can be triggered when the current tab or another tab signs out.
*/
Expand All @@ -365,5 +375,6 @@ export {
reopenAccount,
resendValidationLink,
resetPassword,
clearSignInData,
cleanupSession,
};
4 changes: 2 additions & 2 deletions src/pages/signin/ChangeExpensifyLoginLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -33,7 +33,7 @@ const ChangeExpensifyLoginLink = ({credentials, translate, toLocalPhone}) => (
</Text>
<TouchableOpacity
style={[styles.link]}
onPress={() => redirectToSignIn()}
onPress={clearSignInData}
underlayColor={themeColors.componentBG}
>
<Text style={[styles.link]}>
Expand Down
8 changes: 0 additions & 8 deletions src/pages/signin/SignInPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {},
};

Expand Down Expand Up @@ -115,6 +108,5 @@ export default compose(
withOnyx({
account: {key: ONYXKEYS.ACCOUNT},
credentials: {key: ONYXKEYS.CREDENTIALS},
session: {key: ONYXKEYS.SESSION},
}),
)(SignInPage);

0 comments on commit 61bbde6

Please sign in to comment.