Skip to content

[$250] Expense - "Waiting for you to submit expense" message reappears after approving expense. #74281

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.2.44-1
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-1795/folder/13176702/41236790/994330593
Email or phone of affected tester (no customers): ibellicotest+2008@gmail.com
Issue reported by: Applause Internal Team
Device used: Motorola MotoG60 / Android 12 / Chrome ( mWeb / Hybrid app) - Windows 11 / Chrome
App Component: Money Requests

Action Performed:

Prerequisite: Account has at least one workspace.
Prerequisite 2: Delayed submissions and approvals enabled.

  1. Open the Expensify app.
  2. Open any workspace chat,
  3. Create a manual expense.
  4. Open the report of the just created expense.
  5. Tap on "Submit"
  6. Note that next step message changes to "Waiting for you to approve expenses"
  7. Tap on "Approve"
  8. Note that next step message returns to "Waiting for you to submit expenses" for some seconds.

Expected Result:

After approving an expense, next step message should change to "Waiting for you to pay expenses".

Actual Result:

After approving an expense, "Waiting for you to submit expenses" reappears as next step for some seconds, before "Waiting for you to pay expenses" appears.

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

1.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021986618335336096435
  • Upwork Job ID: 1986618335336096435
  • Last Price Increase: 2025-11-07
  • Automatic offers:
    • aimane-chnaif | Reviewer | 109397719
    • etCoderDysto | Contributor | 109397722
Issue OwnerCurrent Issue Owner: @VictoriaExpensify

Activity

  1. added
    Daily
    Bug
    on Nov 5, 2025
  2. melvin-bot commented on Nov 5, 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. etCoderDysto commented on Nov 5, 2025

    @etCoderDysto
    Contributor

    Proposal

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

    "Waiting for you to submit expense" message reappears after approving expense.

    What is the root cause of that problem?

    We are passing CONST.REPORT.STATUS_NUM.OPEN to predictedNextStatus when we call buildNextStepNew in approveMoneyRequest function

    App/src/libs/actions/IOU.ts

    Lines 10231 to 10238 in 5279e0b

    const optimisticNextStep = buildNextStepNew({
    report: expenseReport,
    predictedNextStatus: CONST.REPORT.STATUS_NUM.OPEN,
    policy,
    currentUserAccountIDParam,
    currentUserEmailParam,
    hasViolations,
    isASAPSubmitBetaEnabled,

    And in buildNextStepNew function, the below copy will be returned since predictedNextStatus = CONST.REPORT.STATUS_NUM.OPEN

    if (report?.total !== 0 && !policy?.harvesting?.enabled && autoReportingFrequency === CONST.POLICY.AUTO_REPORTING_FREQUENCIES.MANUAL) {
    optimisticNextStep.message = [
    {
    text: 'Waiting for ',
    },
    {
    text: `${ownerDisplayName}`,
    type: 'strong',
    clickToCopyText: ownerAccountID === currentUserAccountIDParam ? currentUserEmailParam : '',
    },
    {
    text: ' to ',
    },
    {
    text: 'submit',
    },
    {
    text: ' %expenses.',
    },

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

    1. One we should pass predictedNextStatus that is calculated below to show the right status when multiple approver is configured in advanced approval workflow
      const predictedNextStatus = isLastApprover(approvalChain) ? CONST.REPORT.STATUS_NUM.APPROVED : CONST.REPORT.STATUS_NUM.SUBMITTED;

      We should pass CONST.REPORT.STATUS_NUM.APPROVED to predictedNextStatus
     const optimisticNextStep = buildNextStepNew({ 
         report: expenseReport, 
         predictedNextStatus,
         policy, 
         currentUserAccountIDParam, 
         currentUserEmailParam, 
         hasViolations, 
         isASAPSubmitBetaEnabled, 
    1. Here we should assign you to text prop instead of an admin when the current user is payer.
      Note: If we don't add the second implementation the optimistic next action will be Waiting for **an admin** to pay expenses then it will be changed to the right next action which is Waiting for you to pay expenses. when the back end returns the correct next action. You can see it in the below video
      reimburserAccountID === -1
      ? {
      text: 'an admin',
    • define a function
    const approverTextElement = () => {
            if (reimburserAccountID === -1) {
                if (
                    isPayer(
                        {
                            accountID: currentUserAccountIDParam,
                            email: currentUserEmailParam,
                        },
                        report,
                    )
                ) {
                    return {text: 'you', type: 'strong'};
                }
                return {text: 'an admin'};
            }
            return {text: getDisplayNameForParticipant({accountID: reimburserAccountID}), type: 'strong'};
        };
    
    • and user the function to get the right display name
              optimisticNextStep = {
                    type,
                    icon: CONST.NEXT_STEP.ICONS.HOURGLASS,
                    message: [
                        {
                            text: 'Waiting for ',
                        },
                        approverTextElement(),
                        {
                            text: ' to ',
                        },
    
    Screen.Recording.2025-11-05.at.2.23.24.in.the.afternoon.mp4

    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.

  4. nkdengineer commented on Nov 5, 2025

    @nkdengineer
    Contributor

    Proposal

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

    After approving an expense, "Waiting for you to submit expenses" reappears as next step for some seconds, before "Waiting for you to pay expenses" appears.

    What is the root cause of that problem?

    We always pass the predictedNextStatus as open when approving the money request here

    predictedNextStatus: CONST.REPORT.STATUS_NUM.OPEN,

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

    1. We should pass it as the correct predictedNextStatus instead of APPROVED because it can still be SUBMITTED in the advance approval flow.
    predictedNextStatus,
    

    predictedNextStatus: CONST.REPORT.STATUS_NUM.OPEN,

    1. I noticed that the next step in optimistic data is an expected behavior from here, we display an admin text if no reimburser is set, then we should fix it from the backend instead. If we want to fix it in the frontend, we only need to update these lines to since we already display you if the text is the current user email.
    (!isPayer(
                            {
                                accountID: currentUserAccountIDParam,
                                email: currentUserEmailParam,
                            },
                            report,
                        ) && reimburserAccountID === -1)
                            ? {
                                  text: 'an admin',
                              }
                            : {
                                  text: getDisplayNameForParticipant({accountID: reimburserAccountID === -1 ? currentUserAccountIDParam : reimburserAccountID}),
                                  type: 'strong',
                                  clickToCopyText: getLoginByAccountID(reimburserAccountID === -1 ? currentUserAccountIDParam ?? -1 : reimburserAccountID),
                              },
    

    reimburserAccountID === -1

    What alternative solutions did you explore? (Optional)

    NA

    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.

  5. etCoderDysto commented on Nov 5, 2025

    @etCoderDysto
    Contributor

    Proposal updated to cover all cases

  6. nkdengineer commented on Nov 5, 2025

    @nkdengineer
    Contributor

    Updated proposal

  7. added
    External
    on Nov 7, 2025
  8. changed the title [-]Expense - "Waiting for you to submit expense" message reappears after approving expense.[/-] [+][$250] Expense - "Waiting for you to submit expense" message reappears after approving expense.[/+] on Nov 7, 2025
  9. melvin-bot commented on Nov 7, 2025

    @melvin-bot
  10. added
    Help Wanted
    on Nov 7, 2025
  11. melvin-bot commented on Nov 7, 2025

    @melvin-bot

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

  12. aimane-chnaif commented on Nov 7, 2025

    @aimane-chnaif
    Contributor

    @etCoderDysto's 2nd solution looks good to me.

    The behavior changed and now the current bug in latest version is:
    Expected: "Waiting for you to pay expenses"
    Actual: "Waiting for admin to pay expenses" (optimistic) and then change to you (from backend)

    🎀 👀 🎀 C+ reviewed

  13. 20 remaining items

  14. etCoderDysto commented on Dec 12, 2025

    @etCoderDysto
    Contributor

    Hi @carlosmiceli Are we eligible for partial componsation since my proposal is selected and we worked on the PR even though the issue was fixed in this PR?

    50% payment if the contributor wasn't assigned and
    The proposal was 🎀👀🎀 by the C+, and
    Most of the code used in the fix came from the accepted proposal

    I am quoting from here

  15. aimane-chnaif commented on Dec 12, 2025

    @aimane-chnaif
    Contributor

    This is eligible for full payment. (C+ doc)

    Image

    Example issue: #74977 (comment)
    They're paid 100% even if PR is not created yet after assignment.

  16. etCoderDysto commented on Dec 22, 2025

    @etCoderDysto
    Contributor

    @carlosmiceli a gentle bump on this comment ;)

  17. carlosmiceli commented on Dec 23, 2025

    @carlosmiceli
    Contributor

    Sorry, was basically OOO last week. Yes, agreed with @aimane-chnaif

  18. aimane-chnaif commented on Dec 23, 2025

    @aimane-chnaif
    Contributor

    @carlosmiceli can you please reopen and remove Removing label and bump to Daily?

  19. added
    Daily
    and removed
    Reviewing
    on Dec 23, 2025
  20. etCoderDysto commented on Jan 12, 2026

    @etCoderDysto
    Contributor

    Hi @VictoriaExpensify can you please process payment? I am referring these comments on the payment - comment 1, and comment 2.

    Thanks

  21. VictoriaExpensify commented on Jan 12, 2026

    @VictoriaExpensify
    Contributor

    Sorry for the delay on this - it wasn't showing up in my dashboard.

    Payment summary:
    C: @etCoderDysto paid $250 via UW
    C+: @aimane-chnaif paid $250 via UW

    Thanks!

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

Metadata

Metadata

Labels

BugDailyExternal

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions