refactor: move per diem expense navigation into the UI - #99525
Conversation
…de-to-keep-navigation-handling-in-the-UI-components
|
@linhvovan29546 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] |
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.
|
|
Why aren't we landing the user on the Spend > Expenses page for all these flows? I think that's preferred. |
Our PR just refactors the code and doesn’t change the navigation behavior, so I think this behavior already exists on |
…de-to-keep-navigation-handling-in-the-UI-components
@linhvovan29546 is right we are just refactoring the code, and landing on Spend > Expense only happens if we are creating using FAB from Home, Spend, Workspace, and Account but for Inbox it lands on the destination workspace. I think the current main behaviour landing destination workspace on the is correct if we are creating from Inbox using FAB or on Workspace Chat +. WDYT @JmillsExpensify |
|
Yes that's correct. Let's just make sure the testing steps communicate that correctly. Test 1 and Test 2 don't make that clear, so let's just clarity that the starting point is the Inbox, not other more common pages. |
JmillsExpensify
left a comment
There was a problem hiding this comment.
LGTM with the testing steps clarification.
|
Thanks @JmillsExpensify Clarified more. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridApptelegram-cloud-document-5-6091405803560909075.mp4Android: mWeb Chrometelegram-cloud-document-5-6091405803560909078.mp4iOS: HybridAppScreen.Recording.2026-08-27.at.20.55.27.moviOS: mWeb SafariScreen.Recording.2026-08-27.at.20.30.23.movMacOS: Chrome / SafariScreen.Recording.2026-08-27.at.20.24.55.movScreen.Recording.2026-08-27.at.20.26.11.movScreen.Recording.2026-08-27.at.20.27.42.mov |
| cleanupAfterExpenseCreate({draftTransactionIDs: [CONST.IOU.OPTIMISTIC_TRANSACTION_ID]}); | ||
| } | ||
| } else { | ||
| Log.alert('[useExpenseSubmission] Skipped per diem self-DM submit: missing policy or incomplete custom unit'); |
There was a problem hiding this comment.
We should do something on the UI otherwise the user is stuck in the same place with no idea that something is happening. Can we surface that some error has happened?
Explanation of Change
Seventh PR of #84631
The two per diem submit actions used to handle their own navigation and cleanup after saving an expense dismissing the screen, clearing the draft, and reading the current screen to decide which report to notify.
This moves all of that into the UI, so the actions only write the expense (API + Onyx) and the screen decides where to go next. Same behavior for the user, just handled in the right place.
To keep it safe, a submit that would do nothing (missing policy or an incomplete per diem entry) is now checked in the UI first, so we don't clear the draft or navigate away on a no-op.
Fixed Issues
$ #84631
PROPOSAL: #84631 (comment)
Tests
Setup (one time — skip if your test workspace already has Per diem set up)
Test 1 — Per diem on a workspace (started from the Inbox)
Test 2 — Per diem started from Spend (lands on Spend > Expenses)
Test 3 — Per diem tracked to your Personal space (only if your setup routes per diem to Personal space)
Offline tests
Same as tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests
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
Android-Native.mp4
Android: mWeb Chrome
Android-mWeb.mp4
iOS: Native
iOS-Native.mp4
iOS: mWeb Safari
iOS-Safari.mp4
MacOS: Chrome / Safari
Mac-Chrome.mp4