Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d0cb56d
add recentWaypointCollection to trackExpense
Guccio163 Jan 22, 2026
06c3771
update parameter in trackExpenseIOUActions
Guccio163 Jan 22, 2026
18264a0
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 Jan 22, 2026
ca21b86
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 Jan 22, 2026
900c32e
bump max-warnings
Guccio163 Jan 22, 2026
ee2930f
update following issues links
Guccio163 Jan 23, 2026
d3f2d46
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 Jan 24, 2026
b61409f
bump max-warnings
Guccio163 Jan 24, 2026
ddca299
add tests
Guccio163 Jan 24, 2026
cef1492
fix spell check
Guccio163 Jan 24, 2026
e6e6274
fix spell check 2
Guccio163 Jan 24, 2026
f6cb410
fix lint
Guccio163 Jan 24, 2026
0547f89
fix lint transactions
Guccio163 Jan 24, 2026
88072b9
recentWaypoints not needed in handleFileRetry
Guccio163 Jan 25, 2026
cbcbf68
fix type
Guccio163 Jan 25, 2026
beb2421
fix recentWaypointsCollection and deprecatedRecentWaypoints names and…
Guccio163 Jan 25, 2026
45d5dae
use getRecentWaypoints
Guccio163 Jan 25, 2026
537dfe1
revert bumping max-warnings
Guccio163 Jan 25, 2026
d5e6f57
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 Jan 25, 2026
ca80271
change possible Onyx.connects in test files to getOnyxValue
Guccio163 Jan 25, 2026
3d6f2e0
change getting transactions to getOnyxData
Guccio163 Jan 25, 2026
9dcf54f
fix tests
Guccio163 Jan 26, 2026
a2d5900
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 Jan 26, 2026
14210a7
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 Jan 26, 2026
2dd7718
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 Jan 26, 2026
b623161
Merge branch 'main' of github.com:software-mansion-labs/expensify-app…
Guccio163 Jan 28, 2026
32e4901
restructure tests
Guccio163 Jan 28, 2026
5e1feae
separate trachExpense params to getDefaultTrackExpenseParams
Guccio163 Jan 28, 2026
bed3e48
update comment
Guccio163 Jan 28, 2026
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
3 changes: 3 additions & 0 deletions src/libs/actions/IOU/Duplicate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
getCurrentUserEmail,
getMoneyRequestParticipantsFromReport,
getPolicyTags,
getRecentWaypoints,
getUserAccountID,
requestMoney,
trackExpense,
Expand Down Expand Up @@ -499,6 +500,7 @@ function duplicateExpenseTransaction({

const userAccountID = getUserAccountID();
const currentUserEmail = getCurrentUserEmail();
const recentWaypoints = getRecentWaypoints();

const participants = getMoneyRequestParticipantsFromReport(targetReport, userAccountID);
const transactionDetails = getTransactionDetails(transaction);
Expand Down Expand Up @@ -563,6 +565,7 @@ function duplicateExpenseTransaction({
introSelected,
activePolicyID,
quickAction,
recentWaypoints,
};
return trackExpense(trackExpenseParams);
}
Expand Down
6 changes: 6 additions & 0 deletions src/libs/actions/IOU/MoneyRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import type {GpsPoint} from './index';
import {
createDistanceRequest,
getMoneyRequestParticipantsFromReport,
getRecentWaypoints,
requestMoney,
resetSplitShares,
setCustomUnitRateID,
Expand Down Expand Up @@ -156,6 +157,8 @@ function createTransaction({
reimbursable = true,
isSelfTourViewed,
}: CreateTransactionParams) {
const recentWaypoints = getRecentWaypoints();
Comment thread
Guccio163 marked this conversation as resolved.

for (const [index, receiptFile] of files.entries()) {
const transaction = transactions.find((item) => item.transactionID === receiptFile.transactionID);
const receipt: Receipt = receiptFile.file ?? {};
Expand Down Expand Up @@ -187,6 +190,7 @@ function createTransaction({
introSelected,
activePolicyID,
quickAction,
recentWaypoints,
});
} else {
requestMoney({
Expand Down Expand Up @@ -494,6 +498,7 @@ function handleMoneyRequestStepDistanceNavigation({
}: MoneyRequestStepDistanceNavigationParams) {
const isManualDistance = manualDistance !== undefined;
const isGPSDistance = gpsDistance !== undefined && gpsCoordinates !== undefined;
const recentWaypoints = getRecentWaypoints();

if (transaction?.splitShares && !isManualDistance) {
resetSplitShares(transaction);
Expand Down Expand Up @@ -558,6 +563,7 @@ function handleMoneyRequestStepDistanceNavigation({
introSelected,
activePolicyID,
quickAction,
recentWaypoints,
});
return;
}
Expand Down
23 changes: 16 additions & 7 deletions src/libs/actions/IOU/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@
introSelected: OnyxEntry<OnyxTypes.IntroSelected>;
activePolicyID: string | undefined;
quickAction: OnyxEntry<OnyxTypes.QuickAction>;
recentWaypoints: OnyxEntry<OnyxTypes.RecentWaypoint[]>;
};

type GetTrackExpenseInformationTransactionParams = {
Expand Down Expand Up @@ -761,7 +762,7 @@

let allPersonalDetails: OnyxTypes.PersonalDetailsList = {};
Onyx.connect({
key: ONYXKEYS.PERSONAL_DETAILS_LIST,

Check warning on line 765 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
callback: (value) => {
allPersonalDetails = value ?? {};
},
Expand Down Expand Up @@ -854,7 +855,7 @@
let allTransactionDrafts: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.TRANSACTION_DRAFT,
waitForCollectionCallback: true,

Check warning on line 858 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
callback: (value) => {
allTransactionDrafts = value ?? {};
},
Expand All @@ -868,7 +869,7 @@
if (!value) {
allTransactionViolations = {};
return;
}

Check warning on line 872 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

allTransactionViolations = value;
},
Expand All @@ -877,7 +878,7 @@
let allPolicyTags: OnyxCollection<OnyxTypes.PolicyTagLists> = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.POLICY_TAGS,
waitForCollectionCallback: true,

Check warning on line 881 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
callback: (value) => {
if (!value) {
allPolicyTags = {};
Expand All @@ -891,7 +892,7 @@
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {

Check warning on line 895 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
allReports = value;
},
});
Expand All @@ -904,7 +905,7 @@
allReportNameValuePairs = value;
},
});

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
let userAccountID = -1;
let currentUserEmail = '';
Onyx.connect({
Expand All @@ -913,7 +914,7 @@
currentUserEmail = value?.email ?? '';
userAccountID = value?.accountID ?? CONST.DEFAULT_NUMBER_ID;
},
});

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

let deprecatedCurrentUserPersonalDetails: OnyxEntry<OnyxTypes.PersonalDetails>;
Onyx.connect({
Expand All @@ -923,7 +924,7 @@
},
});

let allReportActions: OnyxCollection<OnyxTypes.ReportActions>;

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
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
Expand All @@ -932,7 +933,7 @@
return;
}
allReportActions = actions;
},

Check warning on line 936 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
});

let personalDetailsList: OnyxEntry<OnyxTypes.PersonalDetailsList>;
Expand All @@ -940,7 +941,7 @@
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => (personalDetailsList = value),
});

Check warning on line 944 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
// Use connectWithoutView because this is created for non-UI task only
let recentAttendees: OnyxEntry<Attendee[]>;
Onyx.connectWithoutView({
Expand All @@ -948,13 +949,10 @@
callback: (value) => (recentAttendees = value),
});

// TODO: remove `recentWaypoints` from this file (https://github.com/Expensify/App/issues/73024)
// `recentWaypoints` 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 recentWaypoints: OnyxTypes.RecentWaypoint[] = [];
let deprecatedRecentWaypoints: OnyxTypes.RecentWaypoint[] = [];
Onyx.connect({
key: ONYXKEYS.NVP_RECENT_WAYPOINTS,
callback: (val) => (recentWaypoints = val ?? []),
callback: (val) => (deprecatedRecentWaypoints = val ?? []),
});

function getAllPersonalDetails(): OnyxTypes.PersonalDetailsList {
Expand Down Expand Up @@ -985,6 +983,15 @@
return userAccountID;
}

function getRecentWaypoints(): OnyxTypes.RecentWaypoint[] {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

NAB: Should we update the name of this function so no one adds new calls being unaware that this is already deprecated?

We can do that in a follow up if it makes sense.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think that we could, but as well as other getter functions in this file, ultimately we'll get rid if it - I think that it can take a while to remove it from here, so we can leave it as it is. The worst case scenario is someone will need it with their migration, so will use it too. If you strongly feel like we should label it with @deprecated, then I can add it, otherwise I would leave it without extra comments just like getter functions above 👍

return deprecatedRecentWaypoints;
}

/**
* This function uses Onyx.connect and should be replaced with useOnyx for reactive data access.
* TODO: remove `getPolicyTagsData` from this file (https://github.com/Expensify/App/issues/72721)
* All usages of this function should be replaced with params passed to the functions or useOnyx hook in React components.
*/
function getPolicyTags(): OnyxCollection<OnyxTypes.PolicyTagLists> {
return allPolicyTags;
}
Expand Down Expand Up @@ -5340,7 +5347,7 @@
}

if (!distance) {
const recentServerValidatedWaypoints = recentWaypoints.filter((item) => !item.pendingAction);
const recentServerValidatedWaypoints = deprecatedRecentWaypoints.filter((item) => !item.pendingAction);
onyxData?.failureData?.push({
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.NVP_RECENT_WAYPOINTS}`,
Expand Down Expand Up @@ -6543,6 +6550,7 @@
introSelected,
activePolicyID,
quickAction,
recentWaypoints = [],
} = params;
const {participant, payeeAccountID, payeeEmail} = participantParams;
const {policy, policyCategories, policyTagList} = policyData;
Expand Down Expand Up @@ -7683,7 +7691,7 @@
};
}

const recentServerValidatedWaypoints = recentWaypoints.filter((item) => !item.pendingAction);
const recentServerValidatedWaypoints = deprecatedRecentWaypoints.filter((item) => !item.pendingAction);
onyxData?.failureData?.push({
onyxMethod: Onyx.METHOD.SET,
key: `${ONYXKEYS.NVP_RECENT_WAYPOINTS}`,
Expand Down Expand Up @@ -13178,6 +13186,7 @@
getAllReportActionsFromIOU,
getCurrentUserEmail,
getUserAccountID,
getRecentWaypoints,
Comment thread
Guccio163 marked this conversation as resolved.
getReceiptError,
getSearchOnyxUpdate,
getPolicyTags,
Expand Down
2 changes: 2 additions & 0 deletions src/pages/Share/SubmitDetailsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ function SubmitDetailsPage({
const defaultTaxCode = getDefaultTaxCode(policy, transaction);
const transactionTaxCode = (transaction?.taxCode ? transaction?.taxCode : defaultTaxCode) ?? '';
const isASAPSubmitBetaEnabled = isBetaEnabled(CONST.BETAS.ASAP_SUBMIT);
const [recentWaypoints] = useOnyx(ONYXKEYS.NVP_RECENT_WAYPOINTS, {canBeMissing: true});

const finishRequestAndNavigate = (participant: Participant, receipt: Receipt, gpsPoint?: GpsPoint) => {
if (!transaction) {
Expand Down Expand Up @@ -160,6 +161,7 @@ function SubmitDetailsPage({
activePolicyID,
introSelected,
quickAction,
recentWaypoints,
});
} else {
requestMoney({
Expand Down
3 changes: 3 additions & 0 deletions src/pages/iou/request/step/IOURequestStepAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ function IOURequestStepAmount({
Navigation.goBack(backTo);
};

const [recentWaypoints] = useOnyx(ONYXKEYS.NVP_RECENT_WAYPOINTS, {canBeMissing: true});

const navigateToNextPage = ({amount, paymentMethod}: AmountParams) => {
isSaveButtonPressed.current = true;
const amountInSmallestCurrencyUnits = convertToBackendAmount(Number.parseFloat(amount));
Expand Down Expand Up @@ -278,6 +280,7 @@ function IOURequestStepAmount({
introSelected,
activePolicyID,
quickAction,
recentWaypoints,
});
return;
}
Expand Down
4 changes: 4 additions & 0 deletions src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,8 @@ function IOURequestStepConfirmation({
],
);

const [recentWaypoints] = useOnyx(ONYXKEYS.NVP_RECENT_WAYPOINTS, {canBeMissing: true});

const trackExpense = useCallback(
(selectedParticipants: Participant[], gpsPoint?: GpsPoint) => {
if (!transactions.length) {
Expand Down Expand Up @@ -795,6 +797,7 @@ function IOURequestStepConfirmation({
introSelected,
activePolicyID,
quickAction,
recentWaypoints,
});
}
},
Expand All @@ -821,6 +824,7 @@ function IOURequestStepConfirmation({
introSelected,
activePolicyID,
quickAction,
recentWaypoints,
],
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,8 @@ function IOURequestStepDistanceOdometer({
Navigation.goBack();
};

const [recentWaypoints] = useOnyx(ONYXKEYS.NVP_RECENT_WAYPOINTS, {canBeMissing: true});

// Navigate to next page following Manual tab pattern
const navigateToNextPage = () => {
const start = parseFloat(startReading);
Expand Down Expand Up @@ -408,6 +410,7 @@ function IOURequestStepDistanceOdometer({
introSelected,
activePolicyID,
quickAction,
recentWaypoints,
});
return;
}
Expand Down
11 changes: 10 additions & 1 deletion tests/actions/IOU/MoneyRequestTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('MoneyRequest', () => {
jest.clearAllMocks();
});

it('should call trackExpense for TRACK iouType', () => {
it('should call trackExpense for TRACK iouType', async () => {
createTransaction({
...baseParams,
iouType: CONST.IOU.TYPE.TRACK,
Expand Down Expand Up @@ -496,6 +496,8 @@ describe('MoneyRequest', () => {

await waitForBatchedUpdates();

const recentWaypoints = (await getOnyxValue(ONYXKEYS.NVP_RECENT_WAYPOINTS)) ?? [];

expect(IOU.trackExpense).toHaveBeenCalledWith({
report: baseParams.report,
isDraftPolicy: false,
Expand Down Expand Up @@ -523,6 +525,7 @@ describe('MoneyRequest', () => {
currentUserEmailParam: baseParams.currentUserLogin,
quickAction: baseParams.quickAction,
shouldHandleNavigation: true,
recentWaypoints,
});
// Should not call request money inside createTransaction function
expect(IOU.requestMoney).not.toHaveBeenCalled();
Expand Down Expand Up @@ -779,6 +782,8 @@ describe('MoneyRequest', () => {

expect(IOU.resetSplitShares).not.toHaveBeenCalled();

const recentWaypoints = (await getOnyxValue(ONYXKEYS.NVP_RECENT_WAYPOINTS)) ?? [];

expect(IOU.trackExpense).toHaveBeenCalledWith({
report: baseParams.report,
isDraftPolicy: false,
Expand Down Expand Up @@ -814,6 +819,7 @@ describe('MoneyRequest', () => {
currentUserAccountIDParam: baseParams.currentUserAccountID,
currentUserEmailParam: baseParams.currentUserLogin,
quickAction: baseParams.quickAction,
recentWaypoints,
});

// The function must return after trackExpense and not call createDistanceRequest
Expand All @@ -840,6 +846,8 @@ describe('MoneyRequest', () => {
waypoints: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD,
});

const recentWaypoints = (await getOnyxValue(ONYXKEYS.NVP_RECENT_WAYPOINTS)) ?? [];

expect(IOU.trackExpense).toHaveBeenCalledWith({
report: baseParams.report,
isDraftPolicy: false,
Expand Down Expand Up @@ -875,6 +883,7 @@ describe('MoneyRequest', () => {
currentUserAccountIDParam: baseParams.currentUserAccountID,
currentUserEmailParam: baseParams.currentUserLogin,
quickAction: baseParams.quickAction,
recentWaypoints,
});
});

Expand Down
Loading
Loading