Skip to content

[Due for payment 2025-07-01] [$250] Per diem - App restarts per diem expense creation flow after clicking Save on subrate page #63111

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.1.54-2
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp
Email or phone of affected tester (no customers): sniodjdsoisjdo@gmail.com
Issue reported by: Applause Internal Team
Device used: Mac 15.4 / Chrome
App Component: Money Requests

Action Performed:

Precondition:

  • Workspace has per diem rates.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Click + > Create report.
  4. Click Add expense button on the expense preview.
  5. Click Create new expense.
  6. Switch to Per diem.
  7. Select a destination.
  8. Select time and date > Save.
  9. Select subrate and enter quantity.
  10. Click Save on subrate page.

Expected Result:

App will proceed to confirmation page.

Actual Result:

App restarts per diem expense creation flow after clicking Save on subrate page.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Bug6846026_1748558387625.20250530_063137.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021929345987036305615
  • Upwork Job ID: 1929345987036305615
  • Last Price Increase: 2025-06-02
  • Automatic offers:
    • brunovjk | Reviewer | 107607279
    • mkzie2 | Contributor | 107607280
Issue OwnerCurrent Issue Owner: @VictoriaExpensify

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 30, 2025
  2. melvin-bot commented on May 30, 2025

    @melvin-bot

    Triggered auto assignment to @VictoriaExpensify (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.

  3. mkzie2 commented on May 30, 2025

    @mkzie2
    Contributor

    Proposal

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

    App restarts per diem expense creation flow after clicking Save on subrate page.

    What is the root cause of that problem?

    The transaction is initialized with reportID pointing to the newly created report (not the workspace report). But the reportID from URL points to the workspace report, because we initialized the flow from the workspace report.

    In this line, after selecting the country, we set the reportID in URL to the workspace report:

    } else if (explicitPolicyID) {
    Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_TIME.getRoute(action, iouType, transactionID, policyExpenseReport?.reportID ?? reportID));

    That logic is to make sure after we confirm the expense creation, we don't automatically open the expense report, but stay in the workspace report.

    Because the transaction.reportID does not match the reportID from URL, we call startMoneyRequest and go back to the first step in the flow (the country step):

    if (
    transaction?.transactionID &&
    (!transaction?.isFromGlobalCreate || !isEmptyObject(transaction?.participants)) &&
    (isCurrentReportID || isMovingTransactionFromTrackExpense || iouType === CONST.IOU.TYPE.INVOICE)
    ) {
    return;
    }
    startMoneyRequest(
    CONST.IOU.TYPE.CREATE,

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

    We should remove this logic:

    } else if (explicitPolicyID) {
    Navigation.navigate(ROUTES.MONEY_REQUEST_STEP_TIME.getRoute(action, iouType, transactionID, policyExpenseReport?.reportID ?? reportID));

    so the reportID in URL always points to the report that the expense to be create would belong to.

    Instead, to make sure this logic still works:

    That logic is to make sure after we confirm the expense creation, we don't automatically open the expense report, but stay in the workspace report.

    We need to implement backToReport URL param for all the per diem steps, and specify it as the current workspace report so after completing the expense creation, we stay in the workspace report. Just like what we did with other types of expense in this PR #61760:

    App/src/ROUTES.ts

    Lines 911 to 915 in f09bb6d

    MONEY_REQUEST_CREATE_TAB_MANUAL: {
    route: ':action/:iouType/start/:transactionID/:reportID/manual/:backToReport?',
    getRoute: (action: IOUAction, iouType: IOUType, transactionID: string, reportID: string, backToReport?: string) =>
    `${action as string}/${iouType as string}/start/${transactionID}/${reportID}/manual/${backToReport ?? ''}` as const,
    },

    What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?

    NA

    What alternative solutions did you explore? (Optional)

    Add another exception in this logic so that we won't trigger startMoneyRequest if requestType is per diem:

    if (
    transaction?.transactionID &&
    (!transaction?.isFromGlobalCreate || !isEmptyObject(transaction?.participants)) &&
    (isCurrentReportID || isMovingTransactionFromTrackExpense || iouType === CONST.IOU.TYPE.INVOICE)
    ) {
    return;
    }

  4. VictoriaExpensify commented on Jun 2, 2025

    @VictoriaExpensify
    Contributor

    Yeah we should fix this

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Jun 2, 2025
  6. changed the title [-]Per diem - App restarts per diem expense creation flow after clicking Save on subrate page[/-] [+][$250] Per diem - App restarts per diem expense creation flow after clicking Save on subrate page[/+] on Jun 2, 2025
  7. melvin-bot commented on Jun 2, 2025

    @melvin-bot
  8. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jun 2, 2025
  9. melvin-bot commented on Jun 2, 2025

    @melvin-bot

    Triggered auto assignment to Contributor-plus team member for initial proposal review - @brunovjk (External)

  10. brunovjk commented on Jun 3, 2025

    @brunovjk
    Contributor

    I think we can go with @mkzie2's proposal. Thanks.

    🎀👀🎀 C+ reviewed

  11. 21 remaining items

  12. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Jun 24, 2025
  13. changed the title [-][$250] Per diem - App restarts per diem expense creation flow after clicking Save on subrate page[/-] [+][Due for payment 2025-07-01] [$250] Per diem - App restarts per diem expense creation flow after clicking Save on subrate page[/+] on Jun 24, 2025
  14. melvin-bot commented on Jun 24, 2025

    @melvin-bot

    Reviewing label has been removed, please complete the "BugZero Checklist".

  15. melvin-bot commented on Jun 24, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.70-7 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:

    If no regressions arise, payment will be issued on 2025-07-01. 🎊

    For reference, here are some details about the assignees on this issue:

  16. melvin-bot commented on Jun 24, 2025

    @melvin-bot

    @brunovjk @VictoriaExpensify @brunovjk The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

  17. brunovjk commented on Jul 1, 2025

    @brunovjk
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 1a. Result of the original design (eg. a case wasn't considered)
    • 1b. Mistake during implementation
    • 1c. Backend bug
    • 1z. Other:

    Where bug was reported:

    • 2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
    • 2b. Reported on staging (eg. found during regression or PR testing)
    • 2d. Reported on a PR
    • 2z. Other:

    Who reported the bug:

    • 3a. Expensify user
    • 3b. Expensify employee
    • 3c. Contributor
    • 3d. QA
    • 3z. Other:
    • [Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.

      Link to comment: No PR directly introduced this bug.

    • [Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.

      Link to discussion:

    • [Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.

    Regression Test Proposal

    Precondition:

    No workspace with per diem enabled

    Tests

    1. Create a workspace Enable Per diem Import per diem rates
    2. Go to the workspace chat + Create report
    3. Click "Add expense" on the report preview Create new expense
    4. Select Per diem Select any destination country Proceed to confirmation step Create expense
    5. Verify the expense is created and linked to the selected report from step 3

    1. Click FAB Create expense Per diem
    2. Proceed to create a per diem expense
    3. Verify the expense is created and linked to the workspace chat with per diem enabled

    1. Create another workspace with per diem enabled and rates imported
    2. Click FAB Create expense
    3. Select any destination workspace
    4. Proceed to create a per diem expense
    5. Verify the expense is created and linked to the selected workspace chat from step 3

    Do we agree 👍 or 👎

  18. VictoriaExpensify commented on Jul 2, 2025

    @VictoriaExpensify
    Contributor
  19. VictoriaExpensify commented on Jul 2, 2025

    @VictoriaExpensify
    Contributor

    Payment Summary:
    C: @mkzie2 paid $250 via Upwork
    C+: @brunovjk paid $250 via Upwork

    Thanks for the hard work!

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

Metadata

Metadata

Labels

Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions