Skip to content

[$250] Expense - Next steps are not visible when the approver opens the report for the first time #75474

Closed

Description

@nlemma

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.2.60-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: Exp
Email or phone of affected tester (no customers): biruknew45+ggsnkj@gmail.com
Issue reported by: Applause Internal Team
Device used: Web, mweb
App Component: Money Requests

Action Performed:

Precondition -
Admin creates a workspace and adds a member.
Admin sets that member as the default approver.

  1. Go to https://staging.new.expensify.com/
  2. As an admin, create an expense in the workspace chat
  3. As an admin, click on the submit button, but do not open the report
  4. As a member(approver), go to the workspace chat of the admin and open the report

Expected Result:

When the admin submits the report, the status updates from Draft to Outstanding. Approver views report as Outstanding in their account without having to click into the report.

Actual Result:

When the approver views the report, it shows as Draft until they click into the report, then it updates to Outstanding, showing the next steps (approval).

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

Bug7007490_1763480770198.bandicam_2025-11-18_18-34-14-821.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021993733805230841191
  • Upwork Job ID: 1993733805230841191
  • Last Price Increase: 2025-12-10
Issue OwnerCurrent Issue Owner: @hungvu193

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Nov 18, 2025
  2. melvin-bot commented on Nov 18, 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. CortneyOfstad commented on Nov 26, 2025

    @CortneyOfstad
    Contributor

    Able to recreate!

  4. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Nov 26, 2025
  5. changed the title [-]Expense - Next steps are not visible when the approver opens the report for the first time[/-] [+][$250] Expense - Next steps are not visible when the approver opens the report for the first time[/+] on Nov 26, 2025
  6. melvin-bot commented on Nov 26, 2025

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

    @melvin-bot

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

  9. fahimj commented on Nov 28, 2025

    @fahimj
    Contributor

    Proposal

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

    Problem: When an approver opens a report immediately after an expense is submitted (before the next step data is available), the Next Steps section does not appear, which prevents the approver from seeing what action they need to take.

    What is the root cause of that problem?

    When openReport is called at src/libs/actions/Report.ts:980-991, it attempts to access the next step message data stored under the key reportNextStep_{reportID} in Onyx. However, when a new expense is submitted and an approver opens the report immediately, this data object does not exist yet because when openReport is called immediately after a report is submitted, it receives the response from the backend first, but the response does not include reportNextStep_{reportID}, so Onyx data cannot be updated with that information.

    Additionally, when report states are updated through Pusher events (such as when an approver approves an expense), the backend does not always include reportNextStep_{reportId} in the Pusher payload. The client receives the report actions via Pusher but does not recalculate the next step message, leaving the reportNextStep_{reportID} object missing in Onyx.

    As a result, the approver must reopen the report after the data has been populated (either through a subsequent openReport API call or a Pusher update that includes the next step data) before the Next Steps section becomes visible.

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

    This solution follows the same approach I outlined in this comment.

    1. Create a new function updateNextStepFromPusherEvents in NextStepUtils.ts to handle next step message creation when report actions are received via Pusher:

      • Filter Pusher updates to find REPORT_ACTIONS updates that contain SUBMITTED, APPROVED, or UNAPPROVED action types
      • Check if Pusher events already contain reportNextStep_{reportId} updates - if they do, skip client-side recalculation and rely on the server-provided values
      • If reportNextStep_{reportId} is not present, extract the report ID from the REPORT_ACTIONS update
      • Get the report and policy data from Onyx
      • Use the report's statusNum (which is updated in the same Pusher batch) to determine the predicted next status
      • Build the new next step message using the existing buildOptimisticNextStep() function
      • Update Onyx with the recalculated next step message by merging it into the report object
    2. Integrate the new function into the existing Pusher event handler in User.ts:

      • Import updateNextStepFromPusherEvents from NextStepUtils
      • Call updateNextStepFromPusherEvents() after Onyx.update() completes in the ONYX_API_UPDATE event handler
      • This ensures the next step message is created whenever relevant actions are received via Pusher, making it available when openReport is called

    This solution ensures that the reportNextStep_{reportID} object exists when openReport is called, regardless of whether the data came from the server or was calculated client-side. The implementation prioritizes server-provided next step message data: if Pusher events contain reportNextStep_{reportId} updates, we use those values directly. Only when the server doesn't provide next step message data do we perform client-side recalculation based on the report's current status.

    What alternative solutions did you explore? (Optional)

    Server-side solution: The server could always include reportNextStep_{reportId} in Pusher payloads or openReport response. This would be ideal but requires backend changes.

  10. 14 remaining items

  11. parasharrajat commented on Dec 10, 2025

    @parasharrajat
    Member

    Wrong issue probably @yuwenmemon this was created 21 days back

  12. parasharrajat commented on Dec 10, 2025

    @parasharrajat
    Member

    Here they are saying that this issue is present on prod too and they faced this again on my PR. Reason that my PR don't solve this issue.

    Image
  13. melvin-bot commented on Dec 10, 2025

    @melvin-bot

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

  14. CortneyOfstad commented on Dec 11, 2025

    @CortneyOfstad
    Contributor

    Hey team! I am heading OoO until Dec. 17. If you need anything from a BZ perspective, please reach out in Slack, otherwise I will get it sorted as soon as I am back! Thanks!

  15. fahimj commented on Dec 11, 2025

    @fahimj
    Contributor

    I re-tested the flow. Now It appears that the approver sees the report as Outstanding without needing to click into the report.

    In the first video (without my change applied), between 00:41 – 00:54, the approver’s view state (on the right) looks correct. However, after the approver completes the approval at 01:15, the owner’s view does not update accordingly.

    before-change.mp4

    With my change applied, after the approver approves the report, the owner’s view updates correctly and reflects the Approved status. See 00:59 in the second video.

    after-fix.mp4
  16. melvin-bot commented on Dec 16, 2025

    @melvin-bot

    @hungvu193 Huh... This is 4 days overdue. Who can take care of this?

  17. hungvu193 commented on Dec 16, 2025

    @hungvu193
    Contributor

    Will retest today

  18. hungvu193 commented on Dec 16, 2025

    @hungvu193
    Contributor

    Oh I couldn't reproduce this issue on latest main, @fahimj are you still able to reproduce it?

  19. fahimj commented on Dec 16, 2025

    @fahimj
    Contributor

    I couldn't reproduce it using main, as in the first video in my previous comment

  20. melvin-bot commented on Dec 16, 2025

    @melvin-bot

    @CortneyOfstad @hungvu193 this issue is now 4 weeks old, please consider:

    • Finding a contributor to fix the bug
    • Closing the issue if BZ has been unable to add the issue to a VIP or Wave project
    • If you have any questions, don't hesitate to start a discussion in #expensify-open-source

    Thanks!

  21. yuwenmemon commented on Dec 16, 2025

    @yuwenmemon
    Contributor

    Looks like it's been fixed then. Closing!

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