Skip to content
Merged
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: 19 additions & 1 deletion src/libs/actions/IOU/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@
let allPersonalDetails: OnyxTypes.PersonalDetailsList = {};
Onyx.connect({
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {

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

Check warning on line 841 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) {
allTransactions = {};
Expand All @@ -852,7 +852,7 @@
let allTransactionDrafts: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.TRANSACTION_DRAFT,
waitForCollectionCallback: true,

Check warning on line 855 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 @@ -861,7 +861,7 @@
let allTransactionViolations: NonNullable<OnyxCollection<OnyxTypes.TransactionViolations>> = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS,
waitForCollectionCallback: true,

Check warning on line 864 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) {
allTransactionViolations = {};
Expand All @@ -875,7 +875,7 @@
let allReports: OnyxCollection<OnyxTypes.Report>;
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,

Check warning on line 878 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) => {
allReports = value;
},
Expand All @@ -884,7 +884,7 @@
let allReportNameValuePairs: OnyxCollection<OnyxTypes.ReportNameValuePairs>;
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS,
waitForCollectionCallback: true,

Check warning on line 887 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) => {
allReportNameValuePairs = value;
},
Expand All @@ -894,7 +894,7 @@
let currentUserEmail = '';
Onyx.connect({
key: ONYXKEYS.SESSION,
callback: (value) => {

Check warning on line 897 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
currentUserEmail = value?.email ?? '';
userAccountID = value?.accountID ?? CONST.DEFAULT_NUMBER_ID;
},
Expand All @@ -903,7 +903,7 @@
let deprecatedCurrentUserPersonalDetails: OnyxEntry<OnyxTypes.PersonalDetails>;
Onyx.connect({
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {

Check warning on line 906 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
deprecatedCurrentUserPersonalDetails = value?.[userAccountID] ?? undefined;
},
});
Expand All @@ -911,7 +911,7 @@
let allReportActions: OnyxCollection<OnyxTypes.ReportActions>;
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,

Check warning on line 914 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: (actions) => {
if (!actions) {
return;
Expand All @@ -923,7 +923,7 @@
let personalDetailsList: OnyxEntry<OnyxTypes.PersonalDetailsList>;
Onyx.connect({
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => (personalDetailsList = value),

Check warning on line 926 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
Expand Down Expand Up @@ -6771,6 +6771,14 @@
break;
}
default: {
if (isGPSDistanceRequest) {
onyxData?.optimisticData?.push({
onyxMethod: Onyx.METHOD.SET,
key: ONYXKEYS.GPS_DRAFT_DETAILS,
value: null,
});
}

const parameters: TrackExpenseParams = {
amount,
attendees: attendees ? JSON.stringify(attendees) : undefined,
Expand Down Expand Up @@ -7598,9 +7606,11 @@

onyxData = moneyRequestOnyxData;

const isGPSDistanceRequest = transaction.iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE_GPS;

if (
transaction.iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE_MAP ||
transaction.iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE_GPS ||
isGPSDistanceRequest ||
isManualDistanceRequest ||
transaction.iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE_ODOMETER
) {
Expand All @@ -7612,6 +7622,14 @@
});
}

if (isGPSDistanceRequest) {
onyxData?.optimisticData?.push({
onyxMethod: Onyx.METHOD.SET,
key: ONYXKEYS.GPS_DRAFT_DETAILS,
value: null,
});
}

parameters = {
comment,
iouReportID: iouReport.reportID,
Expand Down
Loading