Fix trackExpense to include odometer readings in API params#84254
Fix trackExpense to include odometer readings in API params#84254
Conversation
trackExpense receives odometer data from the UI and builds correct optimistic local data, but omits odometerStart and odometerEnd when constructing the API parameters. This means the server never persists odometer readings for selfDM tracked expenses, causing data loss after logout/login and reclassification as manual distance expenses. Also adds isOdometerDistanceRequest to the isDistance flag so the backend correctly identifies odometer expenses as distance requests. Co-authored-by: DylanDylann <DylanDylann@users.noreply.github.com>
Co-authored-by: DylanDylann <DylanDylann@users.noreply.github.com>
|
Fixed the Prettier check failure — a long boolean expression in The Changed files ESLint check failure is not caused by this PR. It's due to 30 pre-existing |
|
@MelvinBot Ready for review. For failed ESLint, we can add |
The eslint-disable-next-line @typescript-eslint/no-deprecated comments were removed in a recent cleanup (#83798) but only partially restored. This restores the remaining 28 missing directives that are needed for the Changed files ESLint check to pass. Co-authored-by: DylanDylann <DylanDylann@users.noreply.github.com>
|
Fixed the failing Root cause: #83798 removed Fix: Restored the 28 missing |
…U/index.ts Co-authored-by: DylanDylann <DylanDylann@users.noreply.github.com>
…adings' into claude-fixTrackExpenseOdometerReadings Co-authored-by: DylanDylann <DylanDylann@users.noreply.github.com>
|
Fixed the failing "Changed files ESLint check" by adding |
|
The failing check ( |
|
@MelvinBot Ready for review. I will review this PR |
|
@MelvinBot Ready for review |
|
@MelvinBot Please mark this PR as ready for review |
|
@DylanDylann Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Done — this PR has been marked as ready for review. ✅ |
Reviewer Checklist
Screenshots/VideosScreen.Recording.2026-03-05.at.16.29.33.mov |
|
@Julesssss The code change looks good to me. However, I noticed an issue with the API response. When tracking an expense in a self DM chat with the odometer type, the BE converts it to the manual type in the response.
|
trjExpensify
left a comment
There was a problem hiding this comment.
bug fix for a WN project 👍
Julesssss
left a comment
There was a problem hiding this comment.
Could you remove the ES lints? I think we should just merge with the failures in this case as there are so many additions
I'll get that resolved. |
|
Backend issue created for the |
|
🚧 @Julesssss has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/Julesssss in version: 9.3.32-0 🚀
|
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.3.32-3 🚀
|

Explanation of Change
The
trackExpensefunction correctly receivesodometerStartandodometerEndfrom the UI and builds correct optimistic local data with them. However, when constructing theTrackExpenseParamsfor theTRACK_EXPENSEAPI call (the default/CREATE case), these fields are omitted entirely. This means the server never receives odometer readings for selfDM tracked expenses, causing the data to be lost after logout/login and the expense to be reclassified as a manual distance expense.This PR:
odometerStart?: numberandodometerEnd?: numberto theTrackExpenseParamstypeodometerStartandodometerEndin the API parameters object within thetrackExpensedefault caseisOdometerDistanceRequestTransactionUtils(transaction)to theisDistanceflag so the backend correctly identifies odometer expenses as distance requestsThis mirrors the existing working pattern in
createDistanceRequest/CreateDistanceRequestParams.Fixed Issues
$ #81728
Tests
odometerExpensesbetaOffline tests
N/A — requires authentication to persist data to server
QA Steps
odometerExpensesbetaPR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
N/A — no UI changes, this is a data pass-through fix
Android: mWeb Chrome
N/A — no UI changes
iOS: Native
N/A — no UI changes
iOS: mWeb Safari
N/A — no UI changes
MacOS: Chrome / Safari
N/A — no UI changes