Skip to content

Commit

Permalink
Merge pull request Expensify#53867 from callstack-internal/fix/53375-…
Browse files Browse the repository at this point in the history
…clear-previous-data-from-card-flow

fix: clear previous data from Expensify Card flow
  • Loading branch information
mountiny authored Dec 18, 2024
2 parents f649baf + 2a8952d commit 1721cf4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/libs/actions/Card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,8 @@ function clearIssueNewCardFlow() {
});
}

function clearIssueNewCardError(issueNewCard: IssueNewCardFlowData) {
Onyx.set(ONYXKEYS.ISSUE_NEW_EXPENSIFY_CARD, {...issueNewCard, errors: null});
function clearIssueNewCardError() {
Onyx.merge(ONYXKEYS.ISSUE_NEW_EXPENSIFY_CARD, {errors: null});
}

function updateExpensifyCardLimit(workspaceAccountID: number, cardID: number, newLimit: number, newAvailableSpend: number, oldLimit?: number, oldAvailableSpend?: number) {
Expand Down
11 changes: 2 additions & 9 deletions src/pages/workspace/expensifyCard/issueNew/ConfirmationStep.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,15 +143,8 @@ function ConfirmationStep({policyID, backTo}: ConfirmationStepProps) {
sendValidateCode={() => User.requestValidateCodeAction()}
validateError={validateError}
hasMagicCodeBeenSent={validateCodeSent}
clearError={() => {
Card.clearIssueNewCardError(issueNewCard);
}}
onClose={() => {
if (validateError) {
Card.clearIssueNewCardError(issueNewCard);
}
setIsValidateCodeActionModalVisible(false);
}}
clearError={() => Card.clearIssueNewCardError()}
onClose={() => setIsValidateCodeActionModalVisible(false)}
isVisible={isValidateCodeActionModalVisible}
title={translate('cardPage.validateCardTitle')}
descriptionPrimary={translate('cardPage.enterMagicCode', {contactMethod: account?.primaryLogin ?? ''})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ function IssueNewCardPage({policy, route}: IssueNewCardPageProps) {
Card.startIssueNewCardFlow(policyID);
}, [policyID]);

useEffect(() => {
return () => {
Card.clearIssueNewCardFlow();
};
}, []);

const getCurrentStep = () => {
switch (currentStep) {
case CONST.EXPENSIFY_CARD.STEP.ASSIGNEE:
Expand Down

0 comments on commit 1721cf4

Please sign in to comment.