Fix distance display preferring stale route distance over manually updated quantity#86569
Draft
neil-marcellini wants to merge 1 commit intomainfrom
Draft
Fix distance display preferring stale route distance over manually updated quantity#86569neil-marcellini wants to merge 1 commit intomainfrom
neil-marcellini wants to merge 1 commit intomainfrom
Conversation
…dated quantity When a user manually updates the distance value in Expensify Classic, UpdateTransaction writes to comment.customUnit.quantity but does not clear routes.route0.distance. Since getDistanceInMeters checked route distance first, the stale route value was displayed instead of the manually updated one. Reverse the priority: prefer customUnit.quantity when set, falling back to routes.route0.distance only when no custom quantity exists. Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
In
getDistanceInMeters, the route distance (transaction.routes.route0.distance) was checked first and took priority overcomment.customUnit.quantity. When a user manually updates the distance value in Expensify Classic,UpdateTransactionwrites only tocomment.customUnit.quantitybut does not clearroutes.route0.distance. This caused the stale route value to be displayed instead of the manually updated distance.The fix reverses the priority: prefer
customUnit.quantitywhen it is set (since it reflects the user's manual update), and only fall back toroutes.route0.distancewhen no custom quantity exists (e.g. during initial distance request creation before the route is completed).Fixed Issues
$ #86568
Tests
Offline tests
N/A - This is a display logic fix that does not involve network requests.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari