Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 5 additions & 4 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -602,10 +602,11 @@ const ROUTES = {
},
MONEY_REQUEST_STEP_CONFIRMATION: {
route: ':action/:iouType/confirmation/:transactionID/:reportID/:backToReport?',
getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string | undefined, backToReport?: string, participantsAutoAssigned?: boolean) =>
`${action as string}/${iouType as string}/confirmation/${transactionID}/${reportID}/${backToReport ?? ''}${
participantsAutoAssigned ? '?participantsAutoAssigned=true' : ''
}` as const,
getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string | undefined, backToReport?: string, participantsAutoAssigned?: boolean, backTo?: string) =>
getUrlWithBackToParam(
`${action as string}/${iouType as string}/confirmation/${transactionID}/${reportID}/${backToReport ?? ''}${participantsAutoAssigned ? '?participantsAutoAssigned=true' : ''}`,
backTo,
),
},
MONEY_REQUEST_STEP_AMOUNT: {
route: ':action/:iouType/amount/:transactionID/:reportID/:pageIndex?/:backToReport?',
Expand Down
2 changes: 1 addition & 1 deletion src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@ type MoneyRequestNavigatorParamList = {
transactionID: string;
reportID: string;
pageIndex?: string;
backTo?: string;
backTo?: Routes;
participantsAutoAssigned?: string;
backToReport?: string;
};
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9914,7 +9914,7 @@ function createDraftTransactionAndNavigateToParticipantSelector(
}

if (actionName === CONST.IOU.ACTION.SHARE) {
Navigation.navigate(ROUTES.MONEY_REQUEST_ACCOUNTANT.getRoute(actionName, CONST.IOU.TYPE.SUBMIT, transactionID, reportID, undefined));
Navigation.navigate(ROUTES.MONEY_REQUEST_ACCOUNTANT.getRoute(actionName, CONST.IOU.TYPE.SUBMIT, transactionID, reportID, Navigation.getActiveRoute()));
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/iou/request/step/IOURequestStepAccountant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function IOURequestStepAccountant({
return;
}

Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_PARTICIPANTS.getRoute(iouType, transactionID, reportID, undefined, action));
Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_PARTICIPANTS.getRoute(iouType, transactionID, reportID, Navigation.getActiveRoute(), action));
}, [iouType, transactionID, reportID, action, currentUserLogin]);

const navigateBack = useCallback(() => {
Expand Down
7 changes: 6 additions & 1 deletion src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function IOURequestStepConfirmation({
report: reportReal,
reportDraft,
route: {
params: {iouType, reportID, transactionID: initialTransactionID, action, participantsAutoAssigned: participantsAutoAssignedFromRoute, backToReport},
params: {iouType, reportID, transactionID: initialTransactionID, action, participantsAutoAssigned: participantsAutoAssignedFromRoute, backToReport, backTo},
},
transaction: initialTransaction,
isLoadingTransaction,
Expand Down Expand Up @@ -296,6 +296,10 @@ function IOURequestStepConfirmation({
}, [transactionIDs, requestType, defaultCategory, policy?.id]);

const navigateBack = useCallback(() => {
if (backTo) {
Navigation.goBack(backTo);
return;
}
// If the action is categorize and there's no policies other than personal one, we simply call goBack(), i.e: dismiss the whole flow together
// We don't need to subscribe to policy_ collection as we only need to check on the latest collection value
if (action === CONST.IOU.ACTION.CATEGORIZE) {
Expand Down Expand Up @@ -357,6 +361,7 @@ function IOURequestStepConfirmation({
reportID,
isMovingTransactionFromTrackExpense,
participantsAutoAssignedFromRoute,
backTo,
]);

const navigateToAddReceipt = useCallback(() => {
Expand Down
3 changes: 3 additions & 0 deletions src/pages/iou/request/step/IOURequestStepParticipants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,9 @@ function IOURequestStepParticipants({
iouType === CONST.IOU.TYPE.CREATE ? CONST.IOU.TYPE.SUBMIT : iouType,
initialTransactionID,
newReportID,
undefined,
undefined,
action === CONST.IOU.ACTION.SHARE ? Navigation.getActiveRoute() : undefined,
);

const route = isCategorizing
Expand Down