Skip to content

Commit

Permalink
Merge pull request #43163 from tienifr/fix/41783
Browse files Browse the repository at this point in the history
fix: app goes back to confirmation page from category page while categorizing
  • Loading branch information
srikarparsi authored Aug 2, 2024
2 parents 157afbf + 615a831 commit b783854
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ const ROUTES = {
},
MONEY_REQUEST_STEP_CONFIRMATION: {
route: ':action/:iouType/confirmation/:transactionID/:reportID',
getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string) =>
`${action as string}/${iouType as string}/confirmation/${transactionID}/${reportID}` as const,
getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string, participantsAutoAssigned?: boolean) =>
`${action as string}/${iouType as string}/confirmation/${transactionID}/${reportID}${participantsAutoAssigned ? '?participantsAutoAssigned=true' : ''}` as const,
},
MONEY_REQUEST_STEP_AMOUNT: {
route: ':action/:iouType/amount/:transactionID/:reportID',
Expand Down
1 change: 1 addition & 0 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,7 @@ type MoneyRequestNavigatorParamList = {
reportID: string;
pageIndex?: string;
backTo?: string;
participantsAutoAssigned?: string;
};
[SCREENS.MONEY_REQUEST.STEP_SCAN]: {
action: IOUAction;
Expand Down
5 changes: 2 additions & 3 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7196,11 +7196,10 @@ function createDraftWorkspaceAndNavigateToConfirmationScreen(transactionID: stri
searchText: policyName,
},
]);
const iouConfirmationPageRoute = ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(actionName, CONST.IOU.TYPE.SUBMIT, transactionID, expenseChatReportID);
if (isCategorizing) {
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CATEGORY.getRoute(actionName, CONST.IOU.TYPE.SUBMIT, transactionID, expenseChatReportID, iouConfirmationPageRoute));
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CATEGORY.getRoute(actionName, CONST.IOU.TYPE.SUBMIT, transactionID, expenseChatReportID));
} else {
Navigation.navigate(iouConfirmationPageRoute);
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(actionName, CONST.IOU.TYPE.SUBMIT, transactionID, expenseChatReportID, true));
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function IOURequestStepConfirmation({
report: reportReal,
reportDraft,
route: {
params: {iouType, reportID, transactionID, action},
params: {iouType, reportID, transactionID, action, participantsAutoAssigned: participantsAutoAssignedFromRoute},
},
transaction,
}: IOURequestStepConfirmationProps) {
Expand Down Expand Up @@ -201,13 +201,13 @@ function IOURequestStepConfirmation({
}
// If there is not a report attached to the IOU with a reportID, then the participants were manually selected and the user needs taken
// back to the participants step
if (!transaction?.participantsAutoAssigned) {
if (!transaction?.participantsAutoAssigned && participantsAutoAssignedFromRoute !== 'true') {
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
Navigation.goBack(ROUTES.MONEY_REQUEST_STEP_PARTICIPANTS.getRoute(iouType, transactionID, transaction?.reportID || reportID, undefined, action));
return;
}
IOUUtils.navigateToStartMoneyRequestStep(requestType, iouType, transactionID, reportID, action);
}, [transaction, iouType, requestType, transactionID, reportID, action]);
}, [transaction, iouType, requestType, transactionID, reportID, action, participantsAutoAssignedFromRoute]);

const navigateToAddReceipt = useCallback(() => {
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_SCAN.getRoute(action, iouType, transactionID, reportID, Navigation.getActiveRouteWithoutParams()));
Expand Down

0 comments on commit b783854

Please sign in to comment.