Skip to content

[Due for payment 2025-09-30] Unable to change IOU recipient when selecting self DM and going back #69134

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: v9.1.98-5
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from TestRail: #68661
Email or phone of affected tester (no customers): applausetester+dp316@applause.expensifail.com
Issue reported by: Applause Internal Team
Device used: Mac / Safari
App Component: Other

Action Performed:

Prerequisites:
User has self DM chat.
User has no workspace.

Steps to Reproduce:

  1. Click “+” → Create expense → Scan.
  2. Click Choose file and select any file.
  3. On the Choose recipient page, select self DM.
  4. On the Confirm details page, observe that you can change the recipient.
  5. Navigate back twice to return to the Create expense page.
  6. Click Manual, and then Scan again
  7. Click Choose file and select any file again.

Expected Result:

User should land on the Choose recipient page to select a recipient, or
Land on the Confirm details page with the option to change the recipient.

Actual Result:

User lands directly on the Confirm details page,
No option to change the recipient is available.

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

Bug6925780_1756090200429.7_38_PM_2025-08-24.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021960449259946354258
  • Upwork Job ID: 1960449259946354258
  • Last Price Increase: 2025-08-26
Issue OwnerCurrent Issue Owner: @stitesExpensify

Activity

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

    @melvin-bot

    Triggered auto assignment to @OfstadC (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. koko57 commented on Aug 25, 2025

    @koko57
    Contributor

    I will look into this as my PR caused this issue, @lakchote please assign me

  4. koko57 commented on Aug 25, 2025

    @koko57
    Contributor

    For some reason when changing from Scan to Manual and back to Scan "isFromGlobalCreate" changes to false. Investigating why and what can I do about it.

    I don't think it's a regression from my latest PR - rather a problem that hasn't been catched earlier because we didn't handle adding new multiple transactions when navigating back to the Scan step. Still, I'll be happy to help with this issue.

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Aug 26, 2025
  6. changed the title [-]Unable to change IOU recipient when selecting self DM and going back[/-] [+][$250] Unable to change IOU recipient when selecting self DM and going back[/+] on Aug 26, 2025
  7. melvin-bot commented on Aug 26, 2025

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

    @melvin-bot

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

  10. huult commented on Aug 27, 2025

    @huult
    Contributor

    Proposal

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

    Unable to change IOU recipient when selecting self DM and going back

    What is the root cause of that problem?

    Here is the condition to show or hide the right icon. I mean, to be able to click and select the recipient.

    shouldShowRightIcon: isCreateExpenseFlow && !isTestReceipt,

    const isCreateExpenseFlow = !!transaction?.isFromGlobalCreate && !isPerDiemRequest;

    The isFromGlobalCreate in the transaction is updated from true to false after changing tabs from Scan to Manual and then back to Scan and so that reason then show right button will not show and to unable select other recipient.

    const isFromGlobalCreate = isEmptyObject(report?.reportID);

    The reason isFromGlobalCreate is updated is because when we change tabs, report?.reportID already exists (since we selected a recipient in step 3). When the tab changes, the hook calls initMoneyRequest, which executes and sets isFromGlobalCreate to false. As a result, the transaction report will be false, causing this issue.

    useEffect(() => {
    if (transaction?.amount !== 0) {
    return;
    }
    initMoneyRequest({
    reportID,
    policy,
    isFromGlobalCreate,
    currentIouRequestType: transaction?.iouRequestType,
    newIouRequestType: transaction?.iouRequestType,
    report,
    parentReport,
    currentDate,
    lastSelectedDistanceRates,
    });
    // eslint-disable-next-line
    }, []);

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

    To resolve this issue, we need to persist the original ‘global create’ state for the transaction so that it doesn’t get reset when the report is updated after recipient selection or tab changes.

    const isFromGlobalCreate = isEmptyObject(report?.reportID);

    update to:

       const initialIsFromGlobalCreateRef = useRef(isEmptyObject(report?.reportID));
        const isFromGlobalCreate = initialIsFromGlobalCreateRef.current;
    Screen.Recording.2025-08-27.at.23.17.44.mp4

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

    none

    What alternative solutions did you explore? (Optional)

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  11. koko57 commented on Aug 27, 2025

    @koko57
    Contributor

    Proposal

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

    After selecting Self DM, going back, changing the IOU type to Manual and back to Scan and adding some more receipts there are 2 problems:

    1. We're redirected to the confirmation step
    2. We're unable to change the participant - the arrow is not displayed

    I've also found out that it's happening for the "Recents" - the participants that we already have a chat with.

    Screen.Recording.2025-08-27.at.18.35.44.mp4

    What is the root cause of that problem?

    As mentioned in the previous proposal - isFromGlobalCreate wrongly set to false so it makes this condition to hide the arrow icon
    App/src/components/MoneyRequestConfirmationList.tsx

    However, unlike the main problem is not in the useEffect on mount but rather in resetIOUTypeIfChanged function.

    const resetIOUTypeIfChanged = useCallback(
    (newIOUType: IOURequestType) => {
    Keyboard.dismiss();
    if (transaction?.iouRequestType === newIOUType) {
    return;
    }
    setIsMultiScanEnabled(false);
    initMoneyRequest({
    reportID,
    policy,
    isFromGlobalCreate,
    currentIouRequestType: transaction?.iouRequestType,
    newIouRequestType: newIOUType,
    report,
    parentReport,
    currentDate,
    lastSelectedDistanceRates,
    });
    },
    [transaction?.iouRequestType, reportID, policy, isFromGlobalCreate, report, parentReport, currentDate, lastSelectedDistanceRates],
    );

    But this is only responsible for the 2nd part of the problem.

    The first part - navigating straight to the confirmation step and skipping participant step - is caused by already having a report object (because we already have a selfDM report or a chat with someone else). When we have a report this condition is true and we're skipping the participants' step

    // If a reportID exists in the report object, it's because either:
    // - The user started this flow from using the + button in the composer inside a report.
    // - The user started this flow from using the global create menu by selecting the Track expense option.
    // In this case, the participants can be automatically assigned from the report and the user can skip the participants step and go straight
    // to the confirm step.
    // If the user is started this flow using the Create expense option (combined submit/track flow), they should be redirected to the participants page.
    if (report?.reportID && !isArchivedReport(reportNameValuePairs) && iouType !== CONST.IOU.TYPE.CREATE) {

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

    I propose an easier solution for the 2nd problem:
    set the isFromGlobalCreate to the value from the current transaction object

     initMoneyRequest({
                    reportID,
                    policy,
                    isFromGlobalCreate: transaction?.isFromGlobalCreate ?? isFromGlobalCreate, // falback to isFromGlobalCreate is optional
                    currentIouRequestType: transaction?.iouRequestType,
                    newIouRequestType: newIOUType,
                    report,
                    parentReport,
                    currentDate,
                    lastSelectedDistanceRates,
                });

    this way we will always have this value in sync and consistent.

    For the first problem we need to change this condition from the request step scan

                // If the user started this flow from using the + button in the composer inside a report
                // the participants can be automatically assigned from the report and the user can skip the participants step and go straight
                // to the confirmation step.
                // If the user started this flow using the Create expense option (combined submit/track flow), they should be redirected to the participants page.
                if (!initialTransaction?.isFromGlobalCreate && !isArchivedReport(reportNameValuePairs) && iouType !== CONST.IOU.TYPE.CREATE) {

    and change the comment above accordingly.

    After applying these changes we can navigate freely back and forth and the arrow icon is displayed (we can change the participant on the confirmation page)

    Screen.Recording.2025-08-27.at.18.59.10.mp4

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

    n/a

    What alternative solutions did you explore? (Optional)

    n/a

  12. huult commented on Aug 27, 2025

    @huult
    Contributor

    @abdulrahuman5196

    contributing guidelines say:

    The difference should be important, meaningful or considerable

    Could you consider this before selected proposal?

    Because I think same #67917 case

  13. 27 remaining items

  14. OfstadC commented on Sep 30, 2025

    @OfstadC
    Contributor

    So I don't think @abdulrahuman5196 is due payment here (please correct me if I am wrong)

  15. melvin-bot commented on Sep 30, 2025

    @melvin-bot

    Payment Summary

    Upwork Job

    • Contributor: @koko57 is from an agency-contributor and not due payment
    • Reviewer: @shubham1206agra owed $250 via NewDot

    BugZero Checklist (@OfstadC)

    • (if NewFeature) I have created a PR for any necessary HelpDot updates, or I confirmed no updates are necessary.
    • 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/1960449259946354258/hired)
    • I have verified the PR was not reverted
    • I have applied any discounts due to bugs/regressions introduced by this PR
    • I have paid out the Upwork contracts or cancelled the ones that are incorrect
    • I have verified the payment summary above is correct
  16. parasharrajat commented on Oct 1, 2025

    @parasharrajat
    Member

    Yes, it was regression issue.

  17. shubham1206agra commented on Oct 1, 2025

    @shubham1206agra
    Contributor

    This was not the regression from #68661 as this issue was created before that PR went to production. Might be some other PR, but not sure right now.

  18. OfstadC commented on Oct 6, 2025

    @OfstadC
    Contributor

    @stitesExpensify do we need to reduce the payment here - it's not clear to me if this is or isn't a regression 😅

  19. stitesExpensify commented on Oct 8, 2025

    @stitesExpensify
    Contributor

    I agree with @shubham1206agra, this could not have been a regression from #68661 because this issue says that the problem was reproducible on production before #68661 ever got to production.

    Given that I think that we keep the normal payment here

  20. OfstadC commented on Oct 9, 2025

    @OfstadC
    Contributor

    Thanks @stitesExpensify ! ❤️

  21. OfstadC commented on Oct 9, 2025

    @OfstadC
    Contributor

    Payment Summary is updated and accurate 😃

    Thanks everyone!

  22. JmillsExpensify commented on Oct 21, 2025

    @JmillsExpensify
    Contributor

    $250 approved for @shubham1206agra

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.DailyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions