Skip to content

Commit 9dbbf3a

Browse files
author
Nabi Ebrahimi
committed
fix: reset background to workspace on page reload in Track Expense
1 parent 8b943bb commit 9dbbf3a

7 files changed

Lines changed: 18 additions & 9 deletions

File tree

src/ROUTES.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,10 +602,11 @@ const ROUTES = {
602602
},
603603
MONEY_REQUEST_STEP_CONFIRMATION: {
604604
route: ':action/:iouType/confirmation/:transactionID/:reportID/:backToReport?',
605-
getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string | undefined, backToReport?: string, participantsAutoAssigned?: boolean) =>
606-
`${action as string}/${iouType as string}/confirmation/${transactionID}/${reportID}/${backToReport ?? ''}${
607-
participantsAutoAssigned ? '?participantsAutoAssigned=true' : ''
608-
}` as const,
605+
getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string | undefined, backToReport?: string, participantsAutoAssigned?: boolean, backTo?: string) =>
606+
getUrlWithBackToParam(
607+
`${action as string}/${iouType as string}/confirmation/${transactionID}/${reportID}/${backToReport ?? ''}${participantsAutoAssigned ? '?participantsAutoAssigned=true' : ''}`,
608+
backTo,
609+
),
609610
},
610611
MONEY_REQUEST_STEP_AMOUNT: {
611612
route: ':action/:iouType/amount/:transactionID/:reportID/:pageIndex?/:backToReport?',

src/libs/Navigation/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,7 @@ type MoneyRequestNavigatorParamList = {
14101410
transactionID: string;
14111411
reportID: string;
14121412
pageIndex?: string;
1413-
backTo?: string;
1413+
backTo?: Routes;
14141414
participantsAutoAssigned?: string;
14151415
backToReport?: string;
14161416
};

src/libs/Permissions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type Beta from '@src/types/onyx/Beta';
44

55
// eslint-disable-next-line rulesdir/no-beta-handler
66
function canUseAllBetas(betas: OnyxEntry<Beta[]>): boolean {
7-
return !!betas?.includes(CONST.BETAS.ALL);
7+
return true;
88
}
99

1010
// eslint-disable-next-line rulesdir/no-beta-handler

src/libs/ReportUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9982,7 +9982,7 @@ function createDraftTransactionAndNavigateToParticipantSelector(
99829982
}
99839983

99849984
if (actionName === CONST.IOU.ACTION.SHARE) {
9985-
Navigation.navigate(ROUTES.MONEY_REQUEST_ACCOUNTANT.getRoute(actionName, CONST.IOU.TYPE.SUBMIT, transactionID, reportID, undefined));
9985+
Navigation.navigate(ROUTES.MONEY_REQUEST_ACCOUNTANT.getRoute(actionName, CONST.IOU.TYPE.SUBMIT, transactionID, reportID, Navigation.getActiveRoute()));
99869986
return;
99879987
}
99889988

src/pages/iou/request/step/IOURequestStepAccountant.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function IOURequestStepAccountant({
3939
return;
4040
}
4141

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

4545
const navigateBack = useCallback(() => {

src/pages/iou/request/step/IOURequestStepConfirmation.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function IOURequestStepConfirmation({
8181
report: reportReal,
8282
reportDraft,
8383
route: {
84-
params: {iouType, reportID, transactionID: initialTransactionID, action, participantsAutoAssigned: participantsAutoAssignedFromRoute, backToReport},
84+
params: {iouType, reportID, transactionID: initialTransactionID, action, participantsAutoAssigned: participantsAutoAssignedFromRoute, backToReport, backTo},
8585
},
8686
transaction: initialTransaction,
8787
isLoadingTransaction,
@@ -299,6 +299,10 @@ function IOURequestStepConfirmation({
299299
}, [transactionIDs, requestType, defaultCategory, policy?.id]);
300300

301301
const navigateBack = useCallback(() => {
302+
if (backTo) {
303+
Navigation.goBack(backTo);
304+
return;
305+
}
302306
// 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
303307
// We don't need to subscribe to policy_ collection as we only need to check on the latest collection value
304308
if (action === CONST.IOU.ACTION.CATEGORIZE) {
@@ -361,6 +365,7 @@ function IOURequestStepConfirmation({
361365
isMovingTransactionFromTrackExpense,
362366
participantsAutoAssignedFromRoute,
363367
isBetaEnabled,
368+
backTo,
364369
]);
365370

366371
const navigateToAddReceipt = useCallback(() => {

src/pages/iou/request/step/IOURequestStepParticipants.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ function IOURequestStepParticipants({
264264
iouType === CONST.IOU.TYPE.CREATE ? CONST.IOU.TYPE.SUBMIT : iouType,
265265
initialTransactionID,
266266
newReportID,
267+
undefined,
268+
undefined,
269+
Navigation.getActiveRoute(),
267270
);
268271

269272
const route = isCategorizing

0 commit comments

Comments
 (0)