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
20 changes: 10 additions & 10 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1416,29 +1416,29 @@ const ROUTES = {
getRoute: (iouType: IOUType, iouRequestType: IOURequestType) => `start/${iouType as string}/${iouRequestType as string}` as const,
},
MONEY_REQUEST_CREATE_TAB_DISTANCE: {
route: 'distance/:backToReport?',
route: 'distance',
getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string, backToReport?: string) =>
`create/${iouType as string}/start/${transactionID}/${reportID}/distance/${backToReport ?? ''}` as const,
`create/${iouType as string}/start/${transactionID}/${reportID}${backToReport ? `/${backToReport}` : ''}/distance` as const,
},
MONEY_REQUEST_CREATE_TAB_MANUAL: {
route: 'manual/:backToReport?',
route: 'manual',
getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string, backToReport?: string) =>
`${action as string}/${iouType as string}/start/${transactionID}/${reportID}/manual/${backToReport ?? ''}` as const,
`${action as string}/${iouType as string}/start/${transactionID}/${reportID}${backToReport ? `/${backToReport}` : ''}/manual` as const,
Comment on lines 1423 to +1426
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep the previous create-expense tab path as an alias

This moves backToReport from the tab suffix to the parent segment (.../manual/<backToReport>.../<backToReport>/manual, and similarly for the other tabs), but there is no migration in src/libs/Navigation/helpers/getMatchingNewRoute.ts or src/libs/Navigation/linkingConfig/OldRoutes.ts. src/libs/Navigation/NavigationRoot.tsx restores lastVisitedPath on startup, so any in-progress create-expense flow saved by the previous build will stop restoring after this deploy; the same applies to browser history/deep links that still use the old tab URLs.

Useful? React with 👍 / 👎.

},
MONEY_REQUEST_CREATE_TAB_SCAN: {
route: 'scan/:backToReport?',
route: 'scan',
getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string, backToReport?: string) =>
`create/${iouType as string}/start/${transactionID}/${reportID}/scan/${backToReport ?? ''}` as const,
`create/${iouType as string}/start/${transactionID}/${reportID}${backToReport ? `/${backToReport}` : ''}/scan` as const,
},
MONEY_REQUEST_CREATE_TAB_PER_DIEM: {
route: 'per-diem/:backToReport?',
route: 'per-diem',
getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string, backToReport?: string) =>
`create/${iouType as string}/start/${transactionID}/${reportID}/per-diem/${backToReport ?? ''}` as const,
`create/${iouType as string}/start/${transactionID}/${reportID}${backToReport ? `/${backToReport}` : ''}/per-diem` as const,
},
MONEY_REQUEST_CREATE_TAB_TIME: {
route: 'time/:backToReport?',
route: 'time',
getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string, backToReport?: string) =>
`create/${iouType as string}/start/${transactionID}/${reportID}/time/${backToReport ?? ''}` as const,
`create/${iouType as string}/start/${transactionID}/${reportID}${backToReport ? `/${backToReport}` : ''}/time` as const,
},

MONEY_REQUEST_RECEIPT_VIEW: {
Expand Down
18 changes: 9 additions & 9 deletions src/libs/IOUUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,36 @@ import {getReportTransactions, isSelfDM} from './ReportUtils';
import {endSpan, getSpan, startSpan} from './telemetry/activeSpans';
import {getCurrency, getTagArrayFromName} from './TransactionUtils';

function navigateToStartMoneyRequestStep(requestType: IOURequestType, iouType: IOUType, transactionID: string, reportID: string, iouAction?: IOUAction): void {
function navigateToStartMoneyRequestStep(requestType: IOURequestType, iouType: IOUType, transactionID: string, reportID: string, iouAction?: IOUAction, backToReport?: string): void {
if (iouAction === CONST.IOU.ACTION.CATEGORIZE || iouAction === CONST.IOU.ACTION.SUBMIT || iouAction === CONST.IOU.ACTION.SHARE) {
Navigation.goBack();
return;
}
// If the participants were automatically added to the transaction, then the user needs taken back to the starting step
switch (requestType) {
case CONST.IOU.REQUEST_TYPE.DISTANCE:
Navigation.goBack(ROUTES.MONEY_REQUEST_CREATE_TAB_DISTANCE.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID), {compareParams: false});
Navigation.goBack(ROUTES.MONEY_REQUEST_CREATE_TAB_DISTANCE.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID, backToReport), {compareParams: false});
break;
case CONST.IOU.REQUEST_TYPE.DISTANCE_MAP:
Navigation.goBack(ROUTES.DISTANCE_REQUEST_CREATE_TAB_MAP.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID), {compareParams: false});
Navigation.goBack(ROUTES.DISTANCE_REQUEST_CREATE_TAB_MAP.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID, backToReport), {compareParams: false});
break;
case CONST.IOU.REQUEST_TYPE.DISTANCE_MANUAL:
Navigation.goBack(ROUTES.DISTANCE_REQUEST_CREATE_TAB_MANUAL.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID), {compareParams: false});
Navigation.goBack(ROUTES.DISTANCE_REQUEST_CREATE_TAB_MANUAL.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID, backToReport), {compareParams: false});
break;
case CONST.IOU.REQUEST_TYPE.DISTANCE_GPS:
Navigation.goBack(ROUTES.DISTANCE_REQUEST_CREATE_TAB_GPS.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID), {compareParams: false});
Navigation.goBack(ROUTES.DISTANCE_REQUEST_CREATE_TAB_GPS.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID, backToReport), {compareParams: false});
break;
case CONST.IOU.REQUEST_TYPE.DISTANCE_ODOMETER:
Navigation.goBack(ROUTES.DISTANCE_REQUEST_CREATE_TAB_ODOMETER.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID), {compareParams: false});
Navigation.goBack(ROUTES.DISTANCE_REQUEST_CREATE_TAB_ODOMETER.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID, backToReport), {compareParams: false});
break;
case CONST.IOU.REQUEST_TYPE.SCAN:
Navigation.goBack(ROUTES.MONEY_REQUEST_CREATE_TAB_SCAN.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID), {compareParams: false});
Navigation.goBack(ROUTES.MONEY_REQUEST_CREATE_TAB_SCAN.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID, backToReport), {compareParams: false});
break;
case CONST.IOU.REQUEST_TYPE.TIME:
Navigation.goBack(ROUTES.MONEY_REQUEST_CREATE_TAB_TIME.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID), {compareParams: false});
Navigation.goBack(ROUTES.MONEY_REQUEST_CREATE_TAB_TIME.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID, backToReport), {compareParams: false});
break;
default:
Navigation.goBack(ROUTES.MONEY_REQUEST_CREATE_TAB_MANUAL.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID), {compareParams: false});
Navigation.goBack(ROUTES.MONEY_REQUEST_CREATE_TAB_MANUAL.getRoute(CONST.IOU.ACTION.CREATE, iouType, transactionID, reportID, backToReport), {compareParams: false});
break;
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/libs/Navigation/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2134,13 +2134,15 @@ type MoneyRequestNavigatorParamList = {
transactionID: string;
reportID: string;
reportActionID: string;
backToReport?: string;
};
[SCREENS.MONEY_REQUEST.STEP_HOURS_EDIT]: {
action: IOUAction;
iouType: Exclude<IOUType, typeof CONST.IOU.TYPE.REQUEST | typeof CONST.IOU.TYPE.SEND>;
transactionID: string;
reportID: string;
reportActionID: string;
backToReport?: string;
};
};

Expand Down
3 changes: 2 additions & 1 deletion src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@
}

// This has selected the participants from the beginning and the participant field shouldn't be editable.
navigateToStartMoneyRequestStep(requestType, iouType, initialTransactionID, reportID, action);
navigateToStartMoneyRequestStep(requestType, iouType, initialTransactionID, reportID, action, backToReport);
}, [
action,
isPerDiemRequest,
Expand All @@ -541,6 +541,7 @@
isMovingTransactionFromTrackExpense,
participantsAutoAssignedFromRoute,
backTo,
backToReport,
]);

// When the component mounts, if there is a receipt, see if the image can be read from the disk. If not, redirect the user to the starting step of the flow.
Expand Down Expand Up @@ -601,7 +602,7 @@
removeDraftTransactionsByIDs(draftTransactionIDs, true);
navigateToStartMoneyRequestStep(requestType, iouType, initialTransactionID, reportID);
});
}, [requestType, iouType, initialTransactionID, reportID, action, report, transactions, participants]);

Check warning on line 605 in src/pages/iou/request/step/IOURequestStepConfirmation.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

React Hook useEffect has a missing dependency: 'draftTransactionIDs'. Either include it or remove the dependency array

const requestMoney = useCallback(
(selectedParticipants: Participant[], gpsPoint?: GpsPoint) => {
Expand Down Expand Up @@ -729,7 +730,7 @@
existingIOUReport = iouReport;
}
},
[

Check warning on line 733 in src/pages/iou/request/step/IOURequestStepConfirmation.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

React Hook useCallback has an unnecessary dependency: 'transactionIDs'. Either exclude it or remove the dependency array
transactionIDs,
transactions,
receiptFiles,
Expand Down
6 changes: 3 additions & 3 deletions src/pages/iou/request/step/IOURequestStepHours.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type IOURequestStepHoursProps = WithWritableReportOrNotFoundProps<
function IOURequestStepHours({
report,
route: {
params: {iouType, reportID, transactionID = '-1', action, reportActionID},
params: {iouType, reportID, transactionID = '-1', action, reportActionID, backToReport},
name: routeName,
},
transaction,
Expand Down Expand Up @@ -120,12 +120,12 @@ function IOURequestStepHours({
setTransactionReport(transactionID, {reportID: policyExpenseChat.reportID}, isTransactionDraft);
setMoneyRequestParticipantsFromReport(transactionID, policyExpenseChat, accountID);

return Navigation.setNavigationActionToMicrotaskQueue(() => navigateToConfirmationPage(iouType, transactionID, policyExpenseChat.reportID, undefined));
return Navigation.setNavigationActionToMicrotaskQueue(() => navigateToConfirmationPage(iouType, transactionID, policyExpenseChat.reportID, backToReport));
}
setMoneyRequestParticipantsFromReport(transactionID, report, accountID);
}

navigateToConfirmationPage(iouType, transactionID, reportID, undefined);
navigateToConfirmationPage(iouType, transactionID, reportID, backToReport);
};

return (
Expand Down
Loading