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
14 changes: 0 additions & 14 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -772,20 +772,6 @@ const ROUTES = {
return getUrlWithBackToParam(`create/split-expense/overview/${reportID}/${originalTransactionID}${splitExpenseTransactionIDPart}`, backTo);
},
},
SPLIT_EXPENSE_SEARCH: {
route: 'create/split-expense/overview/:reportID/:transactionID/:splitExpenseTransactionID?/search',
getRoute: (reportID: string | undefined, originalTransactionID: string | undefined, splitExpenseTransactionID?: string, backTo?: string) => {
if (!reportID || !originalTransactionID) {
Log.warn(`Invalid ${reportID}(reportID) or ${originalTransactionID}(transactionID) is used to build the SPLIT_EXPENSE_SEARCH route`);
}

// eslint-disable-next-line no-restricted-syntax -- Legacy route generation
return getUrlWithBackToParam(
`create/split-expense/overview/${reportID}/${originalTransactionID}${splitExpenseTransactionID ? `/${splitExpenseTransactionID}` : ''}/search`,
backTo,
);
},
},
SPLIT_EXPENSE_CREATE_DATE_RANGE: {
route: 'create/split-expense/create-date-range/:reportID/:transactionID?',
getRoute: (reportID: string | undefined, transactionID: string | undefined, backTo?: string) => {
Expand Down
1 change: 0 additions & 1 deletion src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ const SCREENS = {
STEP_REPORT: 'Money_Request_Report',
EDIT_REPORT: 'Money_Request_Edit_Report',
SPLIT_EXPENSE: 'Money_Request_Split_Expense',
SPLIT_EXPENSE_SEARCH: 'Money_Request_Split_Expense_Search',
SPLIT_EXPENSE_CREATE_DATE_RANGE: 'Money_Request_Split_Expense_Create_Date_Range',
SPLIT_EXPENSE_EDIT: 'Money_Request_Split_Expense_Edit',
DISTANCE_CREATE: 'Money_Request_Distance_Create',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ const MoneyRequestModalStackNavigator = createModalStackNavigator<MoneyRequestNa
[SCREENS.MONEY_REQUEST.STEP_SUBRATE_EDIT]: () => require<ReactComponentModule>('../../../../pages/iou/request/step/IOURequestStepSubrate').default,
[SCREENS.MONEY_REQUEST.RECEIPT_VIEW]: () => require<ReactComponentModule>('../../../../pages/iou/request/step/IOURequestStepScan/ReceiptView').default,
[SCREENS.MONEY_REQUEST.SPLIT_EXPENSE]: () => require<ReactComponentModule>('../../../../pages/iou/SplitExpensePage').default,
[SCREENS.MONEY_REQUEST.SPLIT_EXPENSE_SEARCH]: () => require<ReactComponentModule>('../../../../pages/iou/SplitExpensePage').default,
[SCREENS.MONEY_REQUEST.SPLIT_EXPENSE_CREATE_DATE_RANGE]: () => require<ReactComponentModule>('../../../../pages/iou/SplitExpenseCreateDateRagePage').default,
[SCREENS.MONEY_REQUEST.SPLIT_EXPENSE_EDIT]: () => require<ReactComponentModule>('../../../../pages/iou/SplitExpenseEditPage').default,
[SCREENS.MONEY_REQUEST.DISTANCE_CREATE]: () => require<ReactComponentModule>('../../../../pages/iou/request/DistanceRequestStartPage').default,
Expand Down
25 changes: 4 additions & 21 deletions src/libs/Navigation/helpers/getAdaptedStateFromPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import replacePathInNestedState from './replacePathInNestedState';

let allReports: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 23 in src/libs/Navigation/helpers/getAdaptedStateFromPath.ts

View workflow job for this annotation

GitHub Actions / ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function

Check warning on line 23 in src/libs/Navigation/helpers/getAdaptedStateFromPath.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -43,23 +43,6 @@
return route.params !== undefined && 'reportID' in route.params && typeof route.params.reportID === 'string';
}

/**
* Get the appropriate screen name for RHP_TO_SEARCH lookup.
* Split tabs (amount, percentage, date) are nested routes within SPLIT_EXPENSE/SPLIT_EXPENSE_SEARCH.
* When a split tab route is accessed from search context (path contains '/search'),
* we use SPLIT_EXPENSE_SEARCH for the mapping lookup instead of the tab name.
*/
function getSearchScreenNameForRoute(route: NavigationPartialRoute): string {
const splitTabNames = Object.values(CONST.TAB.SPLIT) as string[];
const isSplitTabRoute = splitTabNames.includes(route.name);

if (isSplitTabRoute && route.path?.includes('/search')) {
return SCREENS.MONEY_REQUEST.SPLIT_EXPENSE_SEARCH;
}

return route.name;
}

function getMatchingFullScreenRoute(route: NavigationPartialRoute) {
// Check for backTo param. One screen with different backTo value may need different screens visible under the overlay.
if (isRouteWithBackToParam(route)) {
Expand All @@ -86,11 +69,11 @@
// If not, get the matching full screen route for the back to state.
return getMatchingFullScreenRoute(focusedStateForBackToRoute);
}
const routeNameForLookup = getSearchScreenNameForRoute(route);
if (RHP_TO_SEARCH[routeNameForLookup]) {
const paramsFromRoute = getParamsFromRoute(RHP_TO_SEARCH[routeNameForLookup]);

if (RHP_TO_SEARCH[route.name]) {
const paramsFromRoute = getParamsFromRoute(RHP_TO_SEARCH[route.name]);
const searchRoute = {
name: RHP_TO_SEARCH[routeNameForLookup],
name: RHP_TO_SEARCH[route.name],
params: paramsFromRoute.length > 0 ? pick(route.params, paramsFromRoute) : undefined,
};
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ const SEARCH_TO_RHP: Partial<Record<keyof SearchFullscreenNavigatorParamList, st
SCREENS.SEARCH.ADVANCED_FILTERS_PURCHASE_CURRENCY_RHP,
SCREENS.SEARCH.ADVANCED_FILTERS_REPORT_FIELD_RHP,
SCREENS.SEARCH.SAVED_SEARCH_RENAME_RHP,
SCREENS.MONEY_REQUEST.SPLIT_EXPENSE_SEARCH,
SCREENS.RIGHT_MODAL.SEARCH_REPORT,
],
};
Expand Down
15 changes: 0 additions & 15 deletions src/libs/Navigation/linkingConfig/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1507,21 +1507,6 @@ const config: LinkingOptions<RootNavigatorParamList>['config'] = {
},
},
},
[SCREENS.MONEY_REQUEST.SPLIT_EXPENSE_SEARCH]: {
path: ROUTES.SPLIT_EXPENSE_SEARCH.route,
exact: true,
screens: {
[CONST.TAB.SPLIT.AMOUNT]: {
path: CONST.TAB.SPLIT.AMOUNT,
},
[CONST.TAB.SPLIT.PERCENTAGE]: {
path: CONST.TAB.SPLIT.PERCENTAGE,
},
[CONST.TAB.SPLIT.DATE]: {
path: CONST.TAB.SPLIT.DATE,
},
},
},
[SCREENS.MONEY_REQUEST.SPLIT_EXPENSE_CREATE_DATE_RANGE]: {
path: ROUTES.SPLIT_EXPENSE_CREATE_DATE_RANGE.route,
exact: true,
Expand Down
13 changes: 3 additions & 10 deletions src/libs/actions/IOU/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@
};

let allPersonalDetails: OnyxTypes.PersonalDetailsList = {};
Onyx.connect({

Check warning on line 756 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
allPersonalDetails = value ?? {};
Expand Down Expand Up @@ -849,7 +849,7 @@
};

let allTransactions: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
Onyx.connect({

Check warning on line 852 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -863,7 +863,7 @@
});

let allTransactionDrafts: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
Onyx.connect({

Check warning on line 866 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION_DRAFT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -872,7 +872,7 @@
});

let allTransactionViolations: NonNullable<OnyxCollection<OnyxTypes.TransactionViolations>> = {};
Onyx.connect({

Check warning on line 875 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -886,7 +886,7 @@
});

let allNextSteps: NonNullable<OnyxCollection<OnyxTypes.ReportNextStepDeprecated>> = {};
Onyx.connect({

Check warning on line 889 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.NEXT_STEP,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -898,14 +898,14 @@
// `allRecentlyUsedTags` was moved here temporarily from `src/libs/actions/Policy/Tag.ts` during the `Deprecate Onyx.connect` refactor.
// All uses of this variable should be replaced with `useOnyx`.
let allRecentlyUsedTags: OnyxCollection<RecentlyUsedTags> = {};
Onyx.connect({

Check warning on line 901 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS,
waitForCollectionCallback: true,
callback: (val) => (allRecentlyUsedTags = val),
});

let allReports: OnyxCollection<OnyxTypes.Report>;
Onyx.connect({

Check warning on line 908 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -914,7 +914,7 @@
});

let allReportNameValuePairs: OnyxCollection<OnyxTypes.ReportNameValuePairs>;
Onyx.connect({

Check warning on line 917 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -924,7 +924,7 @@

let userAccountID = -1;
let currentUserEmail = '';
Onyx.connect({

Check warning on line 927 in src/libs/actions/IOU/index.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.SESSION,
callback: (value) => {
currentUserEmail = value?.email ?? '';
Expand Down Expand Up @@ -14091,11 +14091,8 @@
});

Onyx.set(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`, draftTransaction);
if (isSearchTopmostFullScreenRoute()) {
Navigation.navigate(ROUTES.SPLIT_EXPENSE_SEARCH.getRoute(reportID, originalTransactionID, transaction.transactionID, Navigation.getActiveRoute()));
} else {
Navigation.navigate(ROUTES.SPLIT_EXPENSE.getRoute(reportID, originalTransactionID, transaction.transactionID, Navigation.getActiveRoute()));
}

Navigation.navigate(ROUTES.SPLIT_EXPENSE.getRoute(reportID, originalTransactionID, transaction.transactionID, Navigation.getActiveRoute()));
return;
}

Expand Down Expand Up @@ -14124,11 +14121,7 @@

Onyx.set(`${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transaction?.transactionID}`, draftTransaction);

if (isSearchTopmostFullScreenRoute()) {
Navigation.navigate(ROUTES.SPLIT_EXPENSE_SEARCH.getRoute(reportID, transaction.transactionID, undefined, Navigation.getActiveRoute()));
} else {
Navigation.navigate(ROUTES.SPLIT_EXPENSE.getRoute(reportID, transaction.transactionID, undefined, Navigation.getActiveRoute()));
}
Navigation.navigate(ROUTES.SPLIT_EXPENSE.getRoute(reportID, transaction.transactionID, undefined, Navigation.getActiveRoute()));
}

/**
Expand Down
Loading