Skip to content

Navigation is repeated when returning from per diem confirm page after changing report #82873

Closed

Description

@mitarachim

If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!


Version Number: 9.3.22-1
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #81942
Email or phone of affected tester (no customers): sdjnisodjodijiosj@gmail.com
Issue reported by: Applause Internal Team
Bug source: Exploratory - Significant User Experience Deterioration
Device used: Mac 26.2 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Create two workspaces - A and B.
  • Import per diem rates to both workspaces (can use the same per diem rates).
  1. Go to staging.new.expensify.com
  2. Create two reports in workspace A and B.
  3. Open FAB > Create expense > Per diem.
  4. Select any workspace.
  5. Select any details and reach confirm page.
  6. On confirm page, click Report.
  7. Select report from the other workspace.
  8. On confirm page, click RHP back button three times.
  9. Click RHP back button again.

Expected Result:

RHP will return to per diem initial page.

Actual Result:

RHP reopens subrate page, then back button returns to time and destination page

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome / Safari

Screenshots/Videos

Bug7081891_1771456892150.2.mp4

View all open jobs on GitHub

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    DeployBlockerIndicates it should block deploying the API
    on Feb 18, 2026
  2. melvin-bot commented on Feb 18, 2026

    @melvin-bot

    You have been assigned to this deploy blocker because you recently merged this PR: #81942

  3. melvin-bot commented on Feb 18, 2026

    @melvin-bot

    💬 A slack conversation has been started in #expensify-open-source

  4. melvin-bot commented on Feb 18, 2026

    @melvin-bot

    Triggered auto assignment to @lydiabarclay (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.

  5. github-actions commented on Feb 18, 2026

    @github-actions
    Contributor

    👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open `StagingDeployCash` deploy checklist to see the list of PRs included in this release, then work quickly to do one of the following:

    1. Identify the pull request that introduced this issue and revert it.
    2. Find someone who can quickly fix the issue.
    3. Fix the issue yourself.
  6. MelvinBot commented on Feb 18, 2026

    @MelvinBot
    Contributor

    Proposal

    Please re-state the problem that we are trying to solve in this issue.

    When creating a per diem expense from global create (FAB), selecting a workspace, filling in details (destination, time, subrates), and reaching the confirm page, if the user changes the report to one from a different workspace and then presses the RHP back button, the navigation repeats -- the subrate page reopens, then pressing back shows the time and destination pages again, instead of returning to the per diem initial page.

    What is the root cause of that problem?

    PR #81942 changed selectedPolicyID to undefined for per diem from global create at IOURequestStepReport.tsx:265, enabling cross-workspace report selection. When a user selects a report from a different workspace, handleGlobalCreateReport (lines 99-147) detects the policy changed, clears subrates, resets the customUnitID/rateID, then navigates back to the confirmation page via Navigation.goBack(iouConfirmationPageRoute, {compareParams: false}).

    The POP_TO action updates the confirmation page's reportID param to the new workspace's chatReportID, but the per diem step routes below on the stack (Destination, Time, Subrate) still have the old reportID from the original workspace.

    When the user presses back from the confirmation page, navigateBack at IOURequestStepConfirmation.tsx:438 calls Navigation.goBack(ROUTES.MONEY_REQUEST_STEP_SUBRATE.getRoute(..., reportID)) with the new reportID. The goUp function at Navigation.ts:430 searches the stack for a subrate route with the new reportID but only finds one with the old reportID. Since compareParams defaults to true, there's no match (indexOfBackToRoute === -1), so goUp dispatches a REPLACE action (line 435) instead of popping. This replaces the current screen with a new subrate screen while the old per diem step screens remain below, creating duplicate screens and a navigation loop.

    The stack evolves like this:

    • Before report change: [Start, Destination(A), Time(A), Subrate(A), Confirmation(A)]
    • After report change: [Start, Destination(A), Time(A), Subrate(A), Confirmation(B)]
    • Back from confirmation: [Start, Destination(A), Time(A), Subrate(A), Subrate(B)] (REPLACE instead of POP)
    • Back from subrate(B): [Start, Destination(A), Time(A), Subrate(A), Time(B)] (REPLACE again)

    What changes do you think we should make in order to solve the problem?

    The fix should be in handleGlobalCreateReport in IOURequestStepReport.tsx. When the policy changes for a per diem transaction from global create, instead of just navigating back to the confirmation page (which leaves stale routes with old reportIDs on the stack), the navigation should go back further to the per diem start/destination step to force the user through the per diem flow again with the new workspace context. This is appropriate because clearSubrates already wipes the per diem data, so the user needs to re-enter destination, time, and subrates for the new workspace anyway.

    Alternatively, the navigateBack call in IOURequestStepConfirmation.tsx:438 for per diem could use {compareParams: false} when calling Navigation.goBack for the subrate step, so it matches the existing subrate route by screen name regardless of the reportID param. However, this would still leave the user on an empty subrate page since subrates were cleared.

    What alternative solutions did you explore? (Optional)

    Another approach would be to not clear the subrates at all when the workspace changes and instead attempt to map the per diem data to the new workspace's custom units. However, this would be more complex and may not be correct if the destination workspaces have different per diem rate structures.

    Detailed Investigation

    Evidence Chain

    1. PR fix: report from the other workspace doesn't appear in the report field #81942 change (IOURequestStepReport.tsx:265): selectedPolicyID = isFromGlobalCreate ? undefined : perDiemOriginalPolicy?.id -- enables cross-workspace report selection for per diem from FAB.

    2. handleGlobalCreateReport (IOURequestStepReport.tsx:134-143): When policyChanged && isPerDiemTransaction, calls clearSubrates, setCustomUnitID, setCustomUnitRateID(undefined), then Navigation.goBack(iouConfirmationPageRoute, {compareParams: false}).

    3. goUp with compareParams: false (Navigation.ts:430-444): POP_TO finds confirmation route by name (ignoring params), pops report-step screen, updates confirmation params. Old per diem routes below remain untouched.

    4. Confirmation navigateBack (IOURequestStepConfirmation.tsx:438): Navigation.goBack(ROUTES.MONEY_REQUEST_STEP_SUBRATE.getRoute(action, iouType, initialTransactionID, reportID)) -- uses new reportID from updated route params.

    5. goUp with default compareParams: true (Navigation.ts:430): Searches for subrate route with new reportID, doesn't find it (old reportID on stack), indexOfBackToRoute === -1, dispatches REPLACE instead of POP.

    6. Cascading REPLACE actions: Each back press creates a REPLACE with the new reportID for the next per diem step, while old steps remain on the stack, creating the repeating navigation.

    Relevant Code

    • App/src/pages/iou/request/step/IOURequestStepReport.tsx:99-147 - handleGlobalCreateReport (clears data + navigates)
    • App/src/pages/iou/request/step/IOURequestStepReport.tsx:263-268 - selectedPolicyID computation (PR fix: report from the other workspace doesn't appear in the report field #81942 change)
    • App/src/pages/iou/request/step/IOURequestStepConfirmation.tsx:433-439 - navigateBack for per diem
    • App/src/libs/Navigation/Navigation.ts:405-448 - goUp function (POP_TO vs REPLACE logic)
    • App/src/libs/Navigation/Navigation.ts:344-361 - doesRouteMatchToMinimalActionPayload (param comparison)
    • App/src/hooks/useOutstandingReports.ts:24-34 - Returns all-workspace reports when selectedPolicyID is undefined
    • App/src/ROUTES.ts:1062-1097 - Per diem step route definitions with :reportID param

    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.

  7. izarutskaya commented on Feb 19, 2026

    @izarutskaya

    QA team can't reproduce the issue as workspace B is not displayed in report field list
    Build 9.3.22-2
    Windows 11 / Chrome

    Recording.3646.mp4
    Screen.Recording.2026-02-19.at.14.49.08.mp4

    Samsung A52 / Android 14
    Build 9.3.22-2

    per.diemm.mp4

    iPhone 14Pro Max
    iOS 26.2.1

    Screenrecording.02-19-2026.3-08-05.Pm.1.mp4
  8. MarioExpensify commented on Feb 19, 2026

    @MarioExpensify
    Contributor

    Thank you @izarutskaya. Closing this one - will be fixed in the original issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugSomething is broken. Auto assigns a BugZero manager.EngineeringHourlyKSv2ReviewingHas a PR in review

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions