Repository navigation
fix: Distance expense created in offline is not shown in expense report - #81662
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5b467d9e09
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| } | ||
|
|
||
| const isScanRequest = isScanRequestTransactionUtils({amount, receipt}); | ||
| const isScanRequest = isScanRequestTransactionUtils({amount, receipt, iouRequestType: existingTransaction?.iouRequestType}); |
There was a problem hiding this comment.
Preserve scan detection fallback when request type is unknown
Passing iouRequestType: existingTransaction?.iouRequestType here always adds the iouRequestType key, even when existingTransaction is missing. In isScanRequest() (src/libs/TransactionUtils/index.ts), Object.hasOwn(transaction, 'iouRequestType') then short-circuits to false for undefined, so the fallback receipt.source && amount === 0 logic never runs. For normal scan submissions (where existingTransaction is not provided in requestMoney()), this misclassifies scan expenses as non-scan and changes shouldCreateNewMoneyRequestReport() behavior for ASAP Submit non-submit actions.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Hm, this sounds like valid feedback - what do you think @suneox?
There was a problem hiding this comment.
I've applied that suggestion. Thanks everyone!
There was a problem hiding this comment.
@MelvinBot does the most recent commit resolve the potential problem noted in this review comment? If so, please explain why. If not, please explain why not and recommend a fix.
There was a problem hiding this comment.
Yes, the most recent commit (8c184ef — "fix: apply AI suggestion") resolves the problem.
The original problem: The initial code was:
iouRequestType: existingTransaction?.iouRequestType,This always adds the iouRequestType key to the object, even when existingTransaction is undefined. In that case, the object becomes { amount, receipt, iouRequestType: undefined }. Since Object.hasOwn() in isScanRequest() (src/libs/TransactionUtils/index.ts:238) checks for property existence (not whether the value is truthy), it returns true for undefined values. This causes isScanRequest() to short-circuit and return false (undefined !== CONST.IOU.REQUEST_TYPE.SCAN), bypassing the fallback logic receipt.source && amount === 0 on line 247.
How the fix resolves it: The commit changed the code to a conditional spread:
...(existingTransaction && {
iouRequestType: existingTransaction.iouRequestType,
}),When existingTransaction is falsy (undefined/null), the expression evaluates to ...false, which spreads nothing — so the iouRequestType key is not added to the object at all. Object.hasOwn() then correctly returns false, and isScanRequest() falls through to the receipt/amount fallback logic as intended.
When existingTransaction is present, iouRequestType is included as before, preserving the explicit request-type check.
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppCleanShot.2026-02-10.at.20.03.00_.mp4Android: mWeb ChromeCleanShot.2026-02-10.at.19.59.50_.mp4iOS: HybridAppCleanShot.2026-02-10.at.20.01.22_.mp4iOS: mWeb SafariCleanShot.2026-02-10.at.19.55.41_.mp4MacOS: Chrome / SafariCleanShot.2026-02-10.at.19.53.32_.mp4 |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #80591 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
heyjennahay
left a comment
There was a problem hiding this comment.
No product review required
|
🚧 @rafecolton 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! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/rafecolton in version: 9.3.25-0 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 9.3.25-13 🚀
|
Explanation of Change
Fixed Issues
$ #80591
PROPOSAL: #80591 (comment)
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR 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
Screen.Recording.2026-02-06.at.16.59.05.mov
Android: mWeb Chrome
Screen.Recording.2026-02-06.at.16.54.17.mov
iOS: Native
Screen.Recording.2026-02-06.at.16.48.39.mov
iOS: mWeb Safari
Screen.Recording.2026-02-06.at.16.42.46.mov
MacOS: Chrome / Safari
Screen.Recording.2026-02-06.at.16.36.06.mov