Skip to content
Draft
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
12 changes: 5 additions & 7 deletions src/libs/actions/IOU/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@
};

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

Check warning on line 794 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 @@ -885,7 +885,7 @@
};

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

Check warning on line 888 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 @@ -899,7 +899,7 @@
});

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

Check warning on line 902 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 @@ -908,7 +908,7 @@
});

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

Check warning on line 911 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 @@ -922,7 +922,7 @@
});

let allPolicyTags: OnyxCollection<OnyxTypes.PolicyTagLists> = {};
Onyx.connect({

Check warning on line 925 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_TAGS,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -935,7 +935,7 @@
});

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

Check warning on line 938 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 @@ -944,7 +944,7 @@
});

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

Check warning on line 947 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 @@ -954,7 +954,7 @@

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

Check warning on line 957 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 All @@ -963,7 +963,7 @@
});

let deprecatedCurrentUserPersonalDetails: OnyxEntry<OnyxTypes.PersonalDetails>;
Onyx.connect({

Check warning on line 966 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) => {
deprecatedCurrentUserPersonalDetails = value?.[userAccountID] ?? undefined;
Expand All @@ -971,7 +971,7 @@
});

let allReportActions: OnyxCollection<OnyxTypes.ReportActions>;
Onyx.connect({

Check warning on line 974 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_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand Down Expand Up @@ -5563,7 +5563,7 @@
}

type UpdateMoneyRequestDistanceParams = {
transactionID: string | undefined;
transaction: OnyxEntry<OnyxTypes.Transaction>;
transactionThreadReport: OnyxEntry<OnyxTypes.Report>;
parentReport: OnyxEntry<OnyxTypes.Report>;
waypoints?: WaypointCollection;
Expand All @@ -5584,7 +5584,7 @@

/** Updates the waypoints of a distance expense */
function updateMoneyRequestDistance({
transactionID,
transaction,
transactionThreadReport,
parentReport,
waypoints,
Expand Down Expand Up @@ -5612,10 +5612,10 @@
let data: UpdateMoneyRequestData<UpdateMoneyRequestDataKeys | typeof ONYXKEYS.NVP_RECENT_WAYPOINTS>;
// eslint-disable-next-line @typescript-eslint/no-deprecated
if (isTrackExpenseReport(transactionThreadReport) && isSelfDM(parentReport)) {
data = getUpdateTrackExpenseParams(transactionID, transactionThreadReport?.reportID, transactionChanges, policy);
data = getUpdateTrackExpenseParams(transaction?.transactionID, transactionThreadReport?.reportID, transactionChanges, policy);
} else {
data = getUpdateMoneyRequestParams({
transactionID,
transactionID: transaction?.transactionID,
transactionThreadReport,
iouReport: parentReport,
transactionChanges,
Expand Down Expand Up @@ -5647,8 +5647,6 @@
}

if (transactionBackup) {
const transaction = allTransactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`];

// We need to include all keys of the optimisticData's waypoints in the failureData for onyx merge to properly reset
// waypoint keys that do not exist in the failureData's waypoints. For instance, if the optimisticData waypoints had
// three keys and the failureData waypoint had only 2 keys then the third key that doesn't exist in the failureData
Expand All @@ -5665,7 +5663,7 @@
}, {});
onyxData?.failureData?.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction?.transactionID}`,
value: {
comment: {
waypoints: onyxWaypoints,
Expand Down
5 changes: 2 additions & 3 deletions src/pages/iou/request/step/IOURequestStepDistance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ function IOURequestStepDistance({
}
if (transaction?.transactionID && report?.reportID) {
updateMoneyRequestDistance({
transactionID: transaction?.transactionID,
transaction,
transactionThreadReport: report,
parentReport,
waypoints,
Expand Down Expand Up @@ -467,8 +467,7 @@ function IOURequestStepDistance({
navigateToNextStep,
transactionBackup,
waypoints,
transaction?.routes,
transaction?.transactionID,
transaction,
report,
navigateBack,
parentReport,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function IOURequestStepDistanceManual({
if (action === CONST.IOU.ACTION.EDIT) {
if (distance !== distanceAsFloat) {
updateMoneyRequestDistance({
transactionID: transaction?.transactionID,
transaction,
transactionThreadReport: report,
parentReport,
distance: distanceAsFloat,
Expand Down
5 changes: 2 additions & 3 deletions src/pages/iou/request/step/IOURequestStepDistanceMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ function IOURequestStepDistanceMap({
}
if (transaction?.transactionID && report?.reportID) {
updateMoneyRequestDistance({
transactionID: transaction?.transactionID,
transaction,
transactionThreadReport: report,
parentReport,
waypoints,
Expand Down Expand Up @@ -471,8 +471,7 @@ function IOURequestStepDistanceMap({
policyTags,
policyCategories,
report,
transaction?.routes,
transaction?.transactionID,
transaction,
transactionBackup,
waypoints,
parentReportNextStep,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ function IOURequestStepDistanceOdometer({
if (hasChanges) {
// Update distance (which will also update amount and merchant)
updateMoneyRequestDistance({
transactionID: transaction?.transactionID,
transaction,
transactionThreadReport: report,
parentReport,
distance: calculatedDistance,
Expand Down
Loading