Skip to content

[HOLD for payment 2024-07-10] [$250] "Expense" is showing as a "new comment" when opening the one expense report for the first time #42472

Closed

Description

@m-natarajan

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: 1.4.74-4
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: @puneetlath
Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1716320170918369

Action Performed:

  1. Submit a expense report with one expense as an employee
  2. Sign in as a approver of the expense report (shouldn't be signed in before so that you don't have the expense report or transaction thread locally)
  3. Throttle network connection to slow 3G, so that OpenReport takes a little bit to return
  4. Click on the expense report to view the details

Expected Result:

Should not see a green New line like a comment

Actual Result:

"Expense" is showing as a "new comment" with greenline

Workaround:

unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Recording.102.mp4

Screenshot 2024-05-21 at 3 35 40 PM

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~011a3e7a662efa0b69
  • Upwork Job ID: 1794039154450477056
  • Last Price Increase: 2024-06-07
  • Automatic offers:
    • nkdengineer | Contributor | 102691860
Issue OwnerCurrent Issue Owner: @zanyrenney / @zanyrenney

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 22, 2024
  2. melvin-bot commented on May 22, 2024

    @melvin-bot

    Triggered auto assignment to @zanyrenney (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. nkdengineer commented on May 23, 2024

    @nkdengineer
    Contributor

    Proposal

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

    "Expense" is showing as a "new comment" with greenline

    What is the root cause of that problem?

    Before OpenReport API of the expenseReport is called, transaction thread report actions is empty

    () => ReportActionsUtils.getCombinedReportActions(allReportActions, transactionThreadReportActions),
    [allReportActions, transactionThreadReportActions],

    and then we return all report actions of the expense report which contains the IOU action here

    if (isEmptyObject(transactionThreadReportActions)) {
    return reportActions;
    }

    So this action is displayed as a action in combine report

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

    1. I see that the logic to calculate reportActionsToDisplay is added in this PR Display total and money request in offline #36657. As this comment, the aim of this to generate created action for money request report if it doesn't exist so I think we should use allReportActions which are all report actions of current report to calculate reportActionsToDisplay firstly and then we will use this to get the combine report actions here. So we should move this block here to before this block and use allReportActions instead of reportActions

    // When we are offline before opening an IOU/Expense report,
    // the total of the report and sometimes the expense aren't displayed because these actions aren't returned until `OpenReport` API is complete.
    // We generate a fake created action here if it doesn't exist to display the total whenever possible because the total just depends on report data
    // and we also generate an expense action if the number of expenses in reportActions is less than the total number of expenses
    // to display at least one expense action to match the total data.
    const reportActionsToDisplay = useMemo(() => {

    1. We should add an extra param in getCombinedReportActions like isCombineReport and then we only return reportActions if transactionThreadReportActions is empty and the report isn't a combine report
    if (isEmptyObject(transactionThreadReportActions) && !isCombineReport) {
        return reportActions;
    }
    

    if (isEmptyObject(transactionThreadReportActions)) {
    return reportActions;
    }

    1. Pass !!transactionThreadReportID as isCombineReport param into getCombinedReportActions function
    const combinedReportActions = useMemo(
        () => ReportActionsUtils.getCombinedReportActions(reportActionsToDisplay, transactionThreadReportActions, !!transactionThreadReportID),
        [reportActionsToDisplay, transactionThreadReportActions, transactionThreadReportID],
    );
    

    () => ReportActionsUtils.getCombinedReportActions(allReportActions, transactionThreadReportActions),
    [allReportActions, transactionThreadReportActions],

    1. Finally, pass sortedReportActions={reportActions} here instead of reportActionsToDisplay

    sortedReportActions={reportActionsToDisplay}

    What alternative solutions did you explore? (Optional)

    NA

  4. zanyrenney commented on May 24, 2024

    @zanyrenney
    Contributor

    Adding the external label - looks like NK engineer already has a proposal.

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on May 24, 2024
  6. changed the title [-]"Expense" is showing as a "new comment" when opening the one expense report for the first time[/-] [+][$250] "Expense" is showing as a "new comment" when opening the one expense report for the first time[/+] on May 24, 2024
  7. melvin-bot commented on May 24, 2024

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

    @melvin-bot

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

  10. zanyrenney commented on May 24, 2024

    @zanyrenney
    Contributor

    hey there @mollfpr - please can you review the proposal from @nkdengineer above! thanks!

  11. removed
    BugSomething is broken. Auto assigns a BugZero manager.
    on May 24, 2024
  12. removed their assignment
    on May 24, 2024
  13. 52 remaining items

  14. melvin-bot commented on Jul 3, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.3-7 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 2024-07-10. 🎊

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

  15. melvin-bot commented on Jul 3, 2024

    @melvin-bot

    BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

    • [@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
    • [@mollfpr] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:
    • [@mollfpr] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:
    • [@mollfpr] Determine if we should create a regression test for this bug.
    • [@mollfpr] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
    • [@lschurr / @zanyrenney] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  16. removed their assignment
    on Jul 9, 2024
  17. zanyrenney commented on Jul 10, 2024

    @zanyrenney
    Contributor

    payment summary

    @mollfpr requires payment through NewDot Manual Requests - owed $250 once comment above is complete.
    @nkdengineer requires payment automatic offer (Contributor) - paid $250 on upwork.

  18. zanyrenney commented on Jul 10, 2024

    @zanyrenney
    Contributor

    @srikarparsi please can you do me a favour and once this checklist is complete, close out the issue?

    I am OOO until Tuesday 16th so don't want to keep this open during my OOO if all the steps are complete.

    I have also DM'd @mollfpr

  19. mollfpr commented on Jul 11, 2024

    @mollfpr
    Contributor

    Sorry for the delay 🙏

    [@mollfpr] The PR that introduced the bug has been identified. Link to the PR:
    [@mollfpr] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake. Link to comment:

    No specific PR causing the bug.

    [@mollfpr] A discussion in #expensify-bugs has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner. Link to discussion:

    The regression step should be enough.

    [@mollfpr] Determine if we should create a regression test for this bug.
    [@mollfpr] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.

    1. Submit an expense report with one expense as an employee
    2. Sign in as an approver of the expense report (shouldn't be signed in before so that you don't have the expense report or transaction thread locally)
    3. Throttle network connection to slow 3G, so that OpenReport takes a little bit to return
    4. Click on the expense report to view the details
    5. Verify that no green New line like a comment
    6. 👍 or 👎
  20. JmillsExpensify commented on Jul 11, 2024

    @JmillsExpensify
    Contributor

    $250 approved for @mollfpr

  21. srikarparsi commented on Jul 15, 2024

    @srikarparsi
    Contributor

    The regression steps look good to me. @zanyrenney once you're back from OOO and you have some time, do you know who's in charge of adding the regression test to TestRail?

  22. zanyrenney commented on Jul 17, 2024

    @zanyrenney
    Contributor

    Yep, i can add them!

  23. zanyrenney commented on Jul 17, 2024

    @zanyrenney
    Contributor

    Added, closing! #45595

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.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions