Skip to content

[$250] Recipient field don't update to new WS name after upgrade and saving rate in manual track dist #90641

Closed

Description

@jponikarchuk

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.74-0
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://test-management.browserstack.com/projects/2219752/test-runs/TR-28774/folder/18717689/49855697/1413061698
Email or phone of affected tester (no customers): applausetester+ck513261@applause.expensifail.com
Issue reported by: Applause Internal Team
Bug source: Regression TC Execution
Device used: Windows 11/Chrome, Pixel 8a/Android 16
App Component: Money Requests

Action Performed:

Precondition:

  1. Use Expensifail account (or gmail account)
  2. The user does not have workspace
  3. User have Self-DM

Steps:

  1. Launch Hybrid app or navigate to staging.new.expensify.com
  2. Login with new account
  3. Click the + global create button, select "Track Distance", and go to the "Manual" tab
  4. Enter a valid distance and click "Next"
  5. Select the user’s email address(Personal) as the recipient
  6. Click the "Rate" option row and click "Upgrade"  (A workspace will be created for the user at this stage)
  7. Set a custom distance rate and click "Save"
  8. Observe the To field do not update to new WS name. Instead, still Self DM displayed

Expected Result:

After saving custom distance rate, user get redirected to the "Confirm details" page and the recipient field should get updated to the new workspace name

Actual Result:

Recipient field do not get updated to the new workspace name after upgrading & saving custom distance rate. To field still display the Self DM, user has to select the created WS tapping To field for the manual distance expense to get create in new WS

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

Video.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~022054880018343470361
  • Upwork Job ID: 2054880018343470361
  • Last Price Increase: 2026-05-21

Activity

  1. added
    DeployBlockerCashThis issue or pull request should block deployment
    BugSomething is broken. Auto assigns a BugZero manager.
    and removed
    DeployBlockerCashThis issue or pull request should block deployment
    on May 14, 2026
  2. melvin-bot commented on May 14, 2026

    @melvin-bot

    Triggered auto assignment to @yuwenmemon (DeployBlockerCash), see https://stackoverflowteams.com/c/expensify/questions/9980/ for more details.

  3. github-actions commented on May 14, 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.
  4. melvin-bot commented on May 14, 2026

    @melvin-bot

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

  5. melvin-bot commented on May 14, 2026

    @melvin-bot

    Current assignee @yuwenmemon is eligible for the Engineering assigner, not assigning anyone new.

  6. MelvinBot commented on May 14, 2026

    @MelvinBot
    Contributor

    Proposal

    What is the root cause of that problem?

    When a user clicks "Rate" → "Upgrade" during the Track Distance flow, a new workspace is created but the transaction's participants are never updated to reflect it. The "To" field stays on Self-DM.

    In IOURequestStepUpgrade.tsx, the afterUpgradeAcknowledged callback has two guards that skip participant updates for track expenses:

    1. setMoneyRequestParticipants is gated behind shouldSubmitExpense, which is false for track expenses (set as !isTrackExpense in RateField.tsx:85).
    2. setTransactionReport is gated behind !isTrack, so the transaction's reportID also remains the self-DM.

    Neither CreateDistanceRatePage (only updates the rate) nor the IOURequestStepConfirmation useEffect (short-circuits when participants already exist) compensates for the missing update.

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

    In IOURequestStepUpgrade.tsx, within the DISTANCE_RATES case of afterUpgradeAcknowledged, call setMoneyRequestParticipants for track expenses too (when it's a distance rate upgrade). The transaction participants should be updated to reference the new workspace's policy expense chat, similar to how it's done when shouldSubmitExpense is true. Specifically, the if (shouldSubmitExpense) guard at line 160 should also allow the distance-rate-upgrade + track-expense case through, so the participant is set to the newly created workspace.

    What alternative solutions did you explore? (Optional)

    An alternative would be to update participants in CreateDistanceRatePage after saving the rate, or to modify the IOURequestStepConfirmation useEffect to detect the post-upgrade state and re-set participants. However, updating participants at the point of upgrade in IOURequestStepUpgrade.tsx is the most direct fix since that's where the workspace is created and where the non-track path already handles this correctly.


    Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, @MelvinBot <your feedback> to refine this analysis, or explain why you are rejecting Melvin's proposal.

  7. 20 remaining items

  8. abbasifaizan70 commented on May 14, 2026

    @abbasifaizan70
    Contributor

    Proposal

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

    When a user without a workspace creates a manual distance expense in Self-DM, then upgrades via the "Rate" option to use custom distance rates, the recipient ("To") field does not update to show the new workspace name. The field incorrectly remains as Self-DM, requiring the user to manually tap the "To" field and select the newly created workspace.

    What is the root cause of that problem?

    The issue is in IOURequestStepUpgrade.tsx in the afterUpgradeAcknowledged function.

    1. Participants are not updated for track expenses

    if (shouldSubmitExpense) {
    setMoneyRequestParticipants(transactionID, [
    {
    selected: true,
    accountID: 0,
    isPolicyExpenseChat: true,
    reportID: expenseReportID,
    policyID: policyDataRef.current?.policyID,
    searchText: policyDataRef.current?.policyName,
    },
    ]);
    }

    The problem is that shouldSubmitExpense is false for track expenses. This is set in RateField.tsx:

    shouldSubmitExpense: !isTrackExpense,

    So for track expenses, setMoneyRequestParticipants is never called, and the participants remain pointing to Self-DM.

    2. Transaction report is not updated for track expenses

    // For track expense, we want to create the expense inside self dm (which is not expenseReportID).
    if (!isTrack) {
    setTransactionReport(transactionID, {reportID: expenseReportID}, true);
    // Let the confirmation step decide the distance rate because policy data is not fully available at this step
    setCustomUnitRateID(transactionID, '-1', undefined, undefined);
    Navigation.setParams({reportID: expenseReportID});
    }

    The comment says "For track expense, we want to create the expense inside self dm" - but this logic doesn't account for the upgrade flow where the user is explicitly creating a workspace to use custom distance rates. When upgrading, the expense should be moved to the new workspace.

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

    For distance rate upgrades, we should update the participants and transaction report to use the new workspace, regardless of whether it's a track expense. When a user upgrades to use custom distance rates, they're explicitly choosing to use workspace features.

    Fix in src/pages/iou/request/step/IOURequestStepUpgrade.tsx:

    Change 1: Update the condition to also include distance rate upgrades

    - if (shouldSubmitExpense) {
    + if (shouldSubmitExpense || isDistanceRateUpgrade) {
        setMoneyRequestParticipants(transactionID, [
            {
                selected: true,
                accountID: 0,
                isPolicyExpenseChat: true,
                reportID: expenseReportID,
                policyID: policyDataRef.current?.policyID,
                searchText: policyDataRef.current?.policyName,
            },
        ]);
    }

    Change 2: Update the DISTANCE_RATES case to always use expenseReportID

    switch (upgradePath) {
    case CONST.UPGRADE_PATHS.DISTANCE_RATES: {
    if (!policyID || !reportID) {
    Navigation.goBack();
    return;
    }
    // In case we get here from /:action/track/... route we need to navigate to
    // /:action/submit/... when shouldSubmitExpense === true as transaction is not selfDM anymore
    const backToRoute = shouldSubmitExpense ? ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(action, CONST.IOU.TYPE.SUBMIT, transactionID, reportID) : undefined;
    Navigation.goBack(backToRoute, {compareParams: false});
    // For track expense, we want to create the expense inside self dm (which is not expenseReportID).
    if (!isTrack) {
    setTransactionReport(transactionID, {reportID: expenseReportID}, true);
    // Let the confirmation step decide the distance rate because policy data is not fully available at this step
    setCustomUnitRateID(transactionID, '-1', undefined, undefined);
    Navigation.setParams({reportID: expenseReportID});
    }
    navigateWithMicrotask(ROUTES.WORKSPACE_CREATE_DISTANCE_RATE_UPGRADE.getRoute(policyID, transactionID, isTrack ? reportID : expenseReportID, iouType, action));

    case CONST.UPGRADE_PATHS.DISTANCE_RATES: {
        if (!policyID || !reportID) {
            Navigation.goBack();
            return;
        }
    
    -   // In case we get here from /:action/track/... route we need to navigate to
    -   // /:action/submit/... when shouldSubmitExpense === true as transaction is not selfDM anymore
    -   const backToRoute = shouldSubmitExpense ? ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(action, CONST.IOU.TYPE.SUBMIT, transactionID, reportID) : undefined;
    +   // Navigate to submit confirmation route since the expense is now in the workspace
    +   const backToRoute = ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(action, CONST.IOU.TYPE.SUBMIT, transactionID, expenseReportID);
    
        Navigation.goBack(backToRoute, {compareParams: false});
    
    -   // For track expense, we want to create the expense inside self dm (which is not expenseReportID).
    -   if (!isTrack) {
    -       setTransactionReport(transactionID, {reportID: expenseReportID}, true);
    -       // Let the confirmation step decide the distance rate because policy data is not fully available at this step
    -       setCustomUnitRateID(transactionID, '-1', undefined, undefined);
    -       Navigation.setParams({reportID: expenseReportID});
    -   }
    +   // Update transaction to use the new workspace expense report for all distance rate upgrades
    +   setTransactionReport(transactionID, {reportID: expenseReportID}, true);
    +   // Let the confirmation step decide the distance rate because policy data is not fully available at this step
    +   setCustomUnitRateID(transactionID, '-1', undefined, undefined);
    +   Navigation.setParams({reportID: expenseReportID});
    
    -   navigateWithMicrotask(ROUTES.WORKSPACE_CREATE_DISTANCE_RATE_UPGRADE.getRoute(policyID, transactionID, isTrack ? reportID : expenseReportID, iouType, action));
    +   navigateWithMicrotask(ROUTES.WORKSPACE_CREATE_DISTANCE_RATE_UPGRADE.getRoute(policyID, transactionID, expenseReportID, iouType, action));
        break;
    }
  9. github-actions commented on May 14, 2026

    @github-actions
    Contributor

    ⚠️ @abbasifaizan70 Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  10. emkhalid commented on May 16, 2026

    @emkhalid
    Contributor

    Proposal

    What is the root cause of that problem?

    In src/pages/iou/request/step/IOURequestStepUpgrade.tsx, afterUpgradeAcknowledged() updates the transaction participant to the new workspace only when shouldSubmitExpense is true.

    }
    if (shouldSubmitExpense) {
    setMoneyRequestParticipants(transactionID, [
    {
    selected: true,
    accountID: 0,
    isPolicyExpenseChat: true,
    reportID: expenseReportID,
    policyID: policyDataRef.current?.policyID,
    searchText: policyDataRef.current?.policyName,

    For the reported flow, the Rate row opens the distance-rate upgrade with shouldSubmitExpense: !isTrackExpense.

    if ((!isPolicyExpenseChat && !isTrackExpense) || (shouldNavigateToUpgradePath && isTrackExpense)) {
    Navigation.navigate(
    ROUTES.MONEY_REQUEST_UPGRADE.getRoute({
    action,
    iouType,
    transactionID,
    reportID,
    upgradePath: CONST.UPGRADE_PATHS.DISTANCE_RATES,
    backTo: Navigation.getActiveRoute(),
    shouldSubmitExpense: !isTrackExpense,
    }),

    Because this is a track expense, shouldSubmitExpense is false. So the draft transaction keeps its existing Self-DM participant.

    The same upgrade callback also skips moving the transaction report for track expenses.

    }
    // In case we get here from /:action/track/... route we need to navigate to
    // /:action/submit/... when shouldSubmitExpense === true as transaction is not selfDM anymore
    const backToRoute = shouldSubmitExpense ? ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(action, CONST.IOU.TYPE.SUBMIT, transactionID, reportID) : undefined;
    Navigation.goBack(backToRoute, {compareParams: false});
    // For track expense, we want to create the expense inside self dm (which is not expenseReportID).
    if (!isTrack) {
    setTransactionReport(transactionID, {reportID: expenseReportID}, true);
    // Let the confirmation step decide the distance rate because policy data is not fully available at this step
    setCustomUnitRateID(transactionID, '-1', undefined, undefined);
    Navigation.setParams({reportID: expenseReportID});
    }

    That leaves the draft transaction attached to the Self-DM even though the user just created a workspace for the custom distance rate. After the user saves the custom distance rate, the confirmation page renders the To field from the stale transaction.participants value, so it still shows the Self-DM instead of the new workspace.

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

    Update IOURequestStepUpgrade.tsx so distance-rate upgrades move track expenses to the newly created workspace in the same place where the workspace is created.

    Original participant update code:

    }
    if (shouldSubmitExpense) {
    setMoneyRequestParticipants(transactionID, [
    {
    selected: true,
    accountID: 0,
    isPolicyExpenseChat: true,
    reportID: expenseReportID,
    policyID: policyDataRef.current?.policyID,
    searchText: policyDataRef.current?.policyName,

    +const shouldMoveExpenseToNewWorkspace = shouldSubmitExpense || (upgradePath === CONST.UPGRADE_PATHS.DISTANCE_RATES && isTrack);
    +
    -if (shouldSubmitExpense) {
    +if (shouldMoveExpenseToNewWorkspace) {
         setMoneyRequestParticipants(transactionID, [
             {
                 selected: true,

    Original distance-rate upgrade code:

    }
    // In case we get here from /:action/track/... route we need to navigate to
    // /:action/submit/... when shouldSubmitExpense === true as transaction is not selfDM anymore
    const backToRoute = shouldSubmitExpense ? ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(action, CONST.IOU.TYPE.SUBMIT, transactionID, reportID) : undefined;
    Navigation.goBack(backToRoute, {compareParams: false});
    // For track expense, we want to create the expense inside self dm (which is not expenseReportID).
    if (!isTrack) {
    setTransactionReport(transactionID, {reportID: expenseReportID}, true);
    // Let the confirmation step decide the distance rate because policy data is not fully available at this step
    setCustomUnitRateID(transactionID, '-1', undefined, undefined);
    Navigation.setParams({reportID: expenseReportID});
    }

    -// In case we get here from /:action/track/... route we need to navigate to
    -// /:action/submit/... when shouldSubmitExpense === true as transaction is not selfDM anymore
    -const backToRoute = shouldSubmitExpense ? ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(action, CONST.IOU.TYPE.SUBMIT, transactionID, reportID) : undefined;
    +const nextIOUType = shouldMoveExpenseToNewWorkspace ? CONST.IOU.TYPE.SUBMIT : iouType;
    +const nextReportID = shouldMoveExpenseToNewWorkspace ? expenseReportID : reportID;
    +const backToRoute = shouldMoveExpenseToNewWorkspace ? ROUTES.MONEY_REQUEST_STEP_CONFIRMATION.getRoute(action, nextIOUType, transactionID, nextReportID) : undefined;
     
     Navigation.goBack(backToRoute, {compareParams: false});
     
    -// For track expense, we want to create the expense inside self dm (which is not expenseReportID).
    -if (!isTrack) {
    +if (shouldMoveExpenseToNewWorkspace) {
         setTransactionReport(transactionID, {reportID: expenseReportID}, true);
         // Let the confirmation step decide the distance rate because policy data is not fully available at this step
         setCustomUnitRateID(transactionID, '-1', undefined, undefined);
    -    Navigation.setParams({reportID: expenseReportID});
    +    Navigation.setParams({reportID: expenseReportID, iouType: CONST.IOU.TYPE.SUBMIT});
     }
     
    -navigateWithMicrotask(ROUTES.WORKSPACE_CREATE_DISTANCE_RATE_UPGRADE.getRoute(policyID, transactionID, isTrack ? reportID : expenseReportID, iouType, action));
    +navigateWithMicrotask(ROUTES.WORKSPACE_CREATE_DISTANCE_RATE_UPGRADE.getRoute(policyID, transactionID, nextReportID, nextIOUType, action));

    This keeps normal track distance behavior unchanged. It only changes the distance-rate upgrade path, where the user explicitly creates a workspace to use a workspace distance rate.

    The draft transaction, confirmation route, and distance-rate creation route now all use the new workspace expense chat and submit IOU type. That prevents the confirmation page from reading stale Self-DM participants after the rate is saved.

    What alternative solutions did you explore? (Optional)

    One alternative is to update only setMoneyRequestParticipants() for track distance upgrades. I rejected that because it fixes the visible To field but leaves transaction.reportID, the route reportID, and the route iouType on the old track/Self-DM flow.

    Another alternative is to patch CreateDistanceRatePage.tsx after the user saves the custom rate. That is farther downstream and would require rediscovering the workspace expense chat there. It also spreads the upgrade transition across the rate creation page, even though IOURequestStepUpgrade.tsx already owns the workspace transition.

  11. github-actions commented on May 16, 2026

    @github-actions
    Contributor

    ⚠️ @emkhalid Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.

  12. melvin-bot commented on May 19, 2026

    @melvin-bot

    @cristipaval, @FitseTLT Huh... This is 4 days overdue. Who can take care of this?

  13. FitseTLT commented on May 20, 2026

    @FitseTLT
    Contributor

    @cristipaval this is expected behavior. Distance rate upgrade flow is an exception it should create the expense in self dm. Are u specifically suggesting a behavior change?

  14. melvin-bot commented on May 21, 2026

    @melvin-bot

    📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸

  15. melvin-bot commented on May 25, 2026

    @melvin-bot

    @cristipaval, @FitseTLT Huh... This is 4 days overdue. Who can take care of this?

  16. cristipaval commented on May 26, 2026

    @cristipaval
    Contributor

    yeah I agree this is expected 👍

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributorHelp WantedApply this label when an issue is open to proposals by contributors

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions