Skip to content

[Due for payment 2025-06-16] [Due for payment 2025-06-13] [$250] Track expense - After submitting per diem expense, confirm page in self DM also becomes per diem expense #63361

Closed

Description

@vincdargento

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.56-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): applausetester+020630kh@applause.expensifail.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.
  • Account has self DM.
  1. Go to staging.new.expensify.com
  2. Go to workspace chat.
  3. Click + > Create expense > Per diem.
  4. Create a per diem expense.
  5. Go to self DM.
  6. Click + > Create expense > Manual.
  7. Enter amount.
  8. Click Next.

Expected Result:

The confirmation page will be a manual expense confirmation page.

Actual Result:

The confirmation page is per diem expense confirmation 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

bug.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021929972201414841468
  • Upwork Job ID: 1929972201414841468
  • Last Price Increase: 2025-06-03
Issue OwnerCurrent Issue Owner: @CortneyOfstad / @flaviadefaria
Issue OwnerCurrent Issue Owner: @CortneyOfstad / @flaviadefaria

Activity

  1. added
    Daily
    Bug
    on Jun 3, 2025
  2. melvin-bot commented on Jun 3, 2025

    @melvin-bot

    Triggered auto assignment to @CortneyOfstad (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. bernhardoj commented on Jun 3, 2025

    @bernhardoj
    Contributor

    Proposal

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

    After submitting per diem expense in WS chat, starting a manual expense flow on self DM shows per diem confirm page.

    What is the root cause of that problem?

    When we create a per diem request on a WS, the selected tab is now per-diem. When we open the money request from self DM, money request initialization is called twice.

    const resetIOUTypeIfChanged = useCallback(
    (newIOUType: IOURequestType) => {
    if (transaction?.iouRequestType === newIOUType) {
    return;
    }
    initMoneyRequest(reportID, policy, isFromGlobalCreate, transaction?.iouRequestType, newIOUType);
    },
    [policy, reportID, isFromGlobalCreate, transaction],
    );
    // Clear out the temporary expense if the reportID in the URL has changed from the transaction's reportID.
    useFocusEffect(
    useCallback(() => {
    // The test transaction can change the reportID of the transaction on the flow so we should prevent the reportID from being reverted again.
    if (
    (transaction?.reportID === reportID && iouType !== CONST.IOU.TYPE.CREATE && iouType !== CONST.IOU.TYPE.SUBMIT) ||
    isLoadingSelectedTab ||
    prevTransactionReportID !== transaction?.reportID
    ) {
    return;
    }
    resetIOUTypeIfChanged(transactionRequestType);
    }, [transaction?.reportID, reportID, iouType, resetIOUTypeIfChanged, transactionRequestType, isLoadingSelectedTab, prevTransactionReportID]),
    );

    First is from the tab navigator because per diem is not available, so it's triggered with the new tab, which is manual, so this one is correct.

    <OnyxTabNavigator
    id={CONST.TAB.IOU_REQUEST_TYPE}
    defaultSelectedTab={CONST.TAB_REQUEST.SCAN}
    onTabSelected={resetIOUTypeIfChanged}

    Second is from the useFocusEffect which initialize the iou type from transactionRequestType.

    resetIOUTypeIfChanged(transactionRequestType);

    Since it's a new flow, it will fallback to the selected tab, and in this case, it's per-diem. So, it's wrongly initialized with the wrong type.

    const transactionRequestType = useMemo(
    () => ((transaction?.iouRequestType ?? shouldUseTab) ? selectedTab : CONST.IOU.REQUEST_TYPE.MANUAL),
    [transaction?.iouRequestType, shouldUseTab, selectedTab],
    );

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

    We need to check if per diem request is available, if not, then don't use the selected tab and instead fall back to default or undefined (using undefined works best after this PR is merged).

    const transactionRequestType = useMemo(
        () => {
            if (transaction?.iouRequestType) {
                return transaction.iouRequestType;
            }
    
            if (shouldUseTab) {
                if (selectedTab === CONST.TAB_REQUEST.PER_DIEM && !shouldShowPerDiemOption) {
                    return undefined;
                }
                return selectedTab;
            }
    
            return CONST.IOU.REQUEST_TYPE.MANUAL
        },
        [transaction?.iouRequestType, shouldUseTab, selectedTab, shouldShowPerDiemOption],
    );
    

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

    N/A

  4. removed their assignment
    on Jun 3, 2025
  5. added
    Bug
    and removed
    Bug
    on Jun 3, 2025
  6. melvin-bot commented on Jun 3, 2025

    @melvin-bot

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

  7. self-assigned this
    on Jun 3, 2025
  8. added
    External
    on Jun 3, 2025
  9. changed the title [-]Track expense - After submitting per diem expense, confirm page in self DM also becomes per diem expense[/-] [+][$250] Track expense - After submitting per diem expense, confirm page in self DM also becomes per diem expense[/+] on Jun 3, 2025
  10. melvin-bot commented on Jun 3, 2025

    @melvin-bot
  11. added
    Help Wanted
    on Jun 3, 2025
  12. 24 remaining items

  13. changed the title [-][Due for payment 2025-06-13] [$250] Track expense - After submitting per diem expense, confirm page in self DM also becomes per diem expense[/-] [+][Due for payment 2025-06-16] [Due for payment 2025-06-13] [$250] Track expense - After submitting per diem expense, confirm page in self DM also becomes per diem expense[/+] on Jun 9, 2025
  14. melvin-bot commented on Jun 9, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.62-0 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-06-16. 🎊

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

    • @bernhardoj requires payment through NewDot Manual Requests
    • @dukenv0307 requires payment through NewDot Manual Requests
  15. melvin-bot commented on Jun 9, 2025

    @melvin-bot

    @dukenv0307 @CortneyOfstad / @flaviadefaria @dukenv0307 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]

  16. CortneyOfstad commented on Jun 9, 2025

    @CortneyOfstad
    Contributor

    Thanks for holding down the fort @flaviadefaria!

  17. added
    Daily
    and removed
    Weekly
    on Jun 13, 2025
  18. CortneyOfstad commented on Jun 13, 2025

    @CortneyOfstad
    Contributor

    @dukenv0307 — can you complete the checklist before payment date? This will help make sure there is no delay in issuing the payment summary. Thanks!

  19. dukenv0307 commented on Jun 16, 2025

    @dukenv0307
    Contributor

    I completed it here: #63361 (comment)

  20. melvin-bot commented on Jun 16, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    BugZero Checklist (@CortneyOfstad)

    • I have verified the correct assignees and roles are listed above and updated the necessary manual offers
    • I have verified that there are no duplicate or incorrect contracts on Upwork for this job (https://www.upwork.com/ab/applicants/1929972201414841468/hired)
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  21. CortneyOfstad commented on Jun 16, 2025

    @CortneyOfstad
    Contributor

    Payment Summary

    @bernhardoj — to be paid $250 via NewDot
    @dukenv0307 — to be paid $250 via NewDot

    Regression Test

    https://github.com/Expensify/Expensify/issues/513957

  22. bernhardoj commented on Jun 17, 2025

    @bernhardoj
    Contributor

    Requested in ND.

  23. JmillsExpensify commented on Jun 26, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @dukenv0307

  24. JmillsExpensify commented on Jul 2, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @bernhardoj

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

Metadata

Metadata

Labels

Awaiting PaymentBugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions