Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: lag between language switch on login page #5300

Merged
merged 4 commits into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/libs/actions/Session.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,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,
});
}

export {
continueSessionFromECom,
fetchAccountDetails,
Expand All @@ -307,4 +317,5 @@ export {
reopenAccount,
resendValidationLink,
resetPassword,
clearSignInData,
};
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);