Skip to content

Commit 78c2503

Browse files
authored
Merge pull request Expensify#72449 from callstack-internal/fix-72137
fix building optimistic transaction for negative values
2 parents b4ac907 + 445f06e commit 78c2503

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/libs/actions/IOU.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ import {
199199
isTrackExpenseReport,
200200
prepareOnboardingOnyxData,
201201
shouldCreateNewMoneyRequestReport as shouldCreateNewMoneyRequestReportReportUtils,
202+
shouldEnableNegative,
202203
updateReportPreview,
203204
} from '@libs/ReportUtils';
204205
import {getCurrentSearchQueryJSON} from '@libs/SearchQueryUtils';
@@ -4765,8 +4766,9 @@ function getUpdateTrackExpenseParams(
47654766
// - we're merging two expenses (server does not create MODIFIED_EXPENSE in this flow)
47664767
// In these cases, there isn't a valid optimistic mileage data we can use,
47674768
// and the report action is created on the server with the distance-related response from the MapBox API
4769+
const allowNegative = shouldEnableNegative(transactionThread ?? undefined);
47684770
const updatedReportAction = shouldBuildOptimisticModifiedExpenseReportAction
4769-
? buildOptimisticModifiedExpenseReportAction(transactionThread, transaction, transactionChanges, false, policy, updatedTransaction)
4771+
? buildOptimisticModifiedExpenseReportAction(transactionThread, transaction, transactionChanges, false, policy, updatedTransaction, allowNegative)
47704772
: null;
47714773
if (!hasPendingWaypoints && !(hasModifiedDistanceRate && isFetchingWaypointsFromServer(transaction)) && updatedReportAction) {
47724774
apiParams.reportActionID = updatedReportAction.reportActionID;

0 commit comments

Comments
 (0)