Skip to content

[Merge Account] Remove the initial route from state after successful merge #60751

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

Merged
merged 12 commits into from
May 13, 2025
2 changes: 1 addition & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ const translations = {
lossOfUnsubmittedData: `Merging your accounts is irreversible and will result in the loss of any unsubmitted expenses for `,
enterMagicCode: `To continue, please enter the magic code sent to `,
errors: {
incorrect2fa: 'Incorrect two-factor authentication code. Please try again.',
incorrectMagicCode: 'Incorrect or invalid magic code. Please try again or request a new code.',
fallback: 'Something went wrong. Please try again later.',
},
},
Expand Down
2 changes: 1 addition & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,7 @@ const translations = {
lossOfUnsubmittedData: `Fusionar tus cuentas es irreversible y resultará en la pérdida de cualquier gasto no enviado de `,
enterMagicCode: `Para continuar, por favor introduce el código mágico enviado a `,
errors: {
incorrect2fa: 'Código de autenticación de dos factores incorrecto. Por favor, inténtalo de nuevo.',
incorrectMagicCode: 'Código mágico incorrecto o no válido. Inténtalo de nuevo o solicita otro código.',
fallback: 'Ha ocurrido un error. Por favor, inténtalo mas tarde.',
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const getAuthenticationErrorKey = (err: string): TranslationPaths | null => {
}

if (err.includes('Invalid validateCode')) {
return 'mergeAccountsPage.accountValidate.errors.incorrect2fa';
return 'mergeAccountsPage.accountValidate.errors.incorrectMagicCode';
}

return 'mergeAccountsPage.accountValidate.errors.fallback';
Expand Down
12 changes: 10 additions & 2 deletions src/pages/settings/Security/MergeAccounts/MergeResultPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import HybridAppModule from '@expensify/react-native-hybrid-app';
import {useRoute} from '@react-navigation/native';
import React, {useContext, useMemo} from 'react';
import React, {useContext, useEffect, useMemo} from 'react';
import {useOnyx} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import ConfirmationPage from '@components/ConfirmationPage';
Expand All @@ -23,7 +23,7 @@ import CONFIG from '@src/CONFIG';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import SCREENS from '@src/SCREENS';

function MergeResultPage() {
const styles = useThemeStyles();
Expand Down Expand Up @@ -228,6 +228,14 @@ function MergeResultPage() {
};
}, [setRootStatusBarEnabled, login, translate, userEmailOrPhone, styles]);

useEffect(() => {
if (result !== CONST.MERGE_ACCOUNT_RESULTS.SUCCESS) {
return;
}

Navigation.removeScreenFromNavigationState(SCREENS.SETTINGS.MERGE_ACCOUNTS.ACCOUNT_DETAILS);
}, [result]);

const {
heading,
headingStyle,
Expand Down
Loading