fix: New expense is not added to the retracted report - #81237
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@mkhutornyi 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] |
|
@stitesExpensify 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] |
| }); | ||
| } | ||
|
|
||
| if (chatReport) { |
There was a problem hiding this comment.
❌ CONSISTENCY-3 (docs)
This logic for determining which report should be the iouReportID based on created timestamps is duplicated in the retractReport function (lines 10346-10359). The same logic appears in multiple places with slight variations.
Suggested fix:
Extract this into a reusable helper function to eliminate duplication:
function determineIouReportID(
chatReport: OnyxEntry<OnyxTypes.Report>,
expenseReport: OnyxEntry<OnyxTypes.Report>,
): string | undefined {
if (\!chatReport?.iouReportID || \!expenseReport?.reportID) {
return undefined;
}
const iouReportActions = getAllReportActions(chatReport.iouReportID);
const expenseReportActions = getAllReportActions(expenseReport.reportID);
const iouCreatedAction = Object.values(iouReportActions).find((action) => isCreatedAction(action));
const expenseCreatedAction = Object.values(expenseReportActions).find((action) => isCreatedAction(action));
// The report created later will become the iouReportID of the chat report
return (iouCreatedAction?.created ?? ) > (expenseCreatedAction?.created ?? )
? chatReport.iouReportID
: expenseReport.reportID;
}Then use: iouReportID: determineIouReportID(chatReport, expenseReport)
Please rate this suggestion with 👍 or 👎 to help us improve! Reactions are used to monitor reviewer efficiency.
mkhutornyi
left a comment
There was a problem hiding this comment.
Please merge main and fix lint
| }); | ||
| } | ||
|
|
||
| if (chatReport) { |
|
@mkhutornyi I updated. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safariweb.mov |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
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". |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 @stitesExpensify 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/stitesExpensify in version: 9.3.16-0 🚀
|
|
🚀 Deployed to production by https://github.com/lakchote in version: 9.3.16-9 🚀
|
Explanation of Change
Fixed Issues
$ #79744
PROPOSAL: #79744 (comment)
Tests
Precondition:
Offline tests
Same
QA Steps
Same as test
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-03.at.10.41.22.mov
Android: mWeb Chrome
Screen.Recording.2026-02-03.at.10.05.51.mov
iOS: Native
Screen.Recording.2026-02-03.at.10.34.27.mov
iOS: mWeb Safari
Screen.Recording.2026-02-03.at.10.37.22.mov
MacOS: Chrome / Safari
Screen.Recording.2026-02-03.at.10.03.48.mov