fix: per diem from report preview lands on workspace chat#91266
fix: per diem from report preview lands on workspace chat#91266MobileMage wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5757632851
ℹ️ 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".
| if (shouldHandleNav && result && activeReportID) { | ||
| navigateAfterExpenseCreate({ | ||
| activeReportID, | ||
| activeReportID: backToReport ?? activeReportID, |
There was a problem hiding this comment.
Align pending-new flag with overridden destination report
When backToReport is provided, this call now navigates using backToReport ?? activeReportID, but shouldAddPendingNewTransactionIDs is still computed from the pre-override activeReportID. In cases where backToReport overrides the destination, the app can open the overridden report without adding the pending transaction marker for that report, so the new expense may not be highlighted/treated as new in the destination report preview state.
Useful? React with 👍 / 👎.
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
joekaufmanexpensify
left a comment
There was a problem hiding this comment.
Makes sense 👍
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! ℹ️ 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". |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-05-26.at.20.29.25.mov |
Explanation of Change
Creating a Per Diem expense from a report preview's
Add expensemenu was opening the resulting expense report after submission, instead of leaving the user in the workspace chat (the screen they started from). This differed from Manual, Scan, and Distance, which all correctly stay in the workspace chat.It's caused when the per-diem flow is launched from a report preview,
backToReport(the workspace chat ID) is set on the parent route but gets dropped by the per-diem intermediate step screens (STEP_DESTINATION,STEP_TIME,STEP_SUBRATEdon't carry it). By the timeIOURequestStepConfirmationrenders,backToReportisundefined, so the pre-insert destination (destinationReportID) falls back toreport?.reportID— the expense report — and theSubmitExpenseOrchestratorreveals that route on submit.To fix we align
destinationReportIDinIOURequestStepConfirmation.tsxwith the same "where is the user actually viewing right now" logic thatuseExpenseSubmission.submitPerDiemExpensealready uses for itsactiveReportID. WhenbackToReportis missing andreportis an expense/IOU/invoice report that the user is not currently viewing, fall back to its parent chat (report.chatReportID) instead of the expense report itself. When the user is viewing the expense report, keep the existing behavior (stay on it).Also kept the matching
backToReport ?? activeReportIDchange inuseExpenseSubmission.tsso the slow-path navigation honorsbackToReporttoo, consistent withrequestMoney/createDistanceRequest.Fixed Issues
$ #91093
PROPOSAL: #91093 (comment)
Tests
Precondition — give a workspace per diem rates:
destination, subRate, amount, currency).Repro:
#admins).Offline tests
Same as Tests, performed while offline:
QA Steps
Same as Tests.
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)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
Kapture.2026-05-21.at.07.40.16.mp4
Android: mWeb Chrome
iOS: Native
Kapture.2026-05-21.at.07.04.20.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari
Kapture.2026-05-21.at.06.52.40.mp4