Skip to content

[Due for payment 2025-05-22] [$250] Reports - Held expense disappears after approving pending expense from Reports #57605

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
8 tasks done
IuliiaHerets opened this issue Feb 28, 2025 · 35 comments
Assignees
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2

Comments

@IuliiaHerets
Copy link

IuliiaHerets commented Feb 28, 2025

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Version Number: 9.1.7-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: N/A
If this was caught during regression testing, add the test name, ID and link from TestRail: Exp
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Device used: Mac 15.3 / Chrome
App Component: Search

Action Performed:

  1. Go to staging.new.expensify.com
  2. Create a new workspace.
  3. Go to workspace chat.
  4. Submit two manual expenses to the workspace chat.
  5. Click Submit button.
  6. Click on the expense preview.
  7. Hold one of the expenses.
  8. Go to Reports > Expense reports.
  9. Click Review.
  10. Click Approve.
  11. Approve the pending amount (green button).
  12. Close the RHP.
  13. Refresh the page.

Expected Result:

In Step 12, the held expense should appear as a separate report after approving the pending amount.

Actual Result:

In Step 12, the held expense disappears after approving the pending amount.
In Step 13, the held expense only appears after refreshing the page.

Workaround:

Unknown

Platforms:

  • Android: Standalone
  • Android: HybridApp
  • Android: mWeb Chrome
  • iOS: Standalone
  • iOS: HybridApp
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Bug6757350_1740733666225.20250228_170200.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021895498808351616709
  • Upwork Job ID: 1895498808351616709
  • Last Price Increase: 2025-02-28
Issue OwnerCurrent Issue Owner: @
Issue OwnerCurrent Issue Owner: @Christinadobrzyn
@IuliiaHerets IuliiaHerets added Bug Something is broken. Auto assigns a BugZero manager. Daily KSv2 labels Feb 28, 2025
Copy link

melvin-bot bot commented Feb 28, 2025

Triggered auto assignment to @Christinadobrzyn (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.

@Christinadobrzyn
Copy link
Contributor

Oh this is a good one, not sure if this should be internal - so we'll start with external.

@Christinadobrzyn Christinadobrzyn added the External Added to denote the issue can be worked on by a contributor label Feb 28, 2025
@melvin-bot melvin-bot bot changed the title Reports - Held expense disappears after approving pending expense from Reports [$250] Reports - Held expense disappears after approving pending expense from Reports Feb 28, 2025
Copy link

melvin-bot bot commented Feb 28, 2025

Job added to Upwork: https://www.upwork.com/jobs/~021895498808351616709

@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label Feb 28, 2025
Copy link

melvin-bot bot commented Feb 28, 2025

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

@LorenzoBloedow
Copy link
Contributor

Proposal

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

Held expense disappears after we approve the pending expense from the same workspace.

What is the root cause of that problem?

This hook which updates the list by searching after it detects a new report is assuming that report action IDs can only change in the chat category.

if ((!isChat && hasTransactionsIDsChange) || (isChat && hasReportActionsIDsChange)) {

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

Remove isChat from the second condition in the if statement:

if ((!isChat && hasTransactionsIDsChange) || hasReportActionsIDsChange) {

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

Unit test that calls IOU.approveMoneyRequest (the function that gets called when you approve the expense not on hold) with the same conditions of this bug and then checks to see if SearchActions.search has been called.

Alternatively, in order not to touch implementation details, we could create an E2E test that approves the expense and then checks to see if the held expense is present in the page.

What alternative solutions did you explore? (Optional)

N/A

@Christinadobrzyn
Copy link
Contributor

@thesahindia can you check out the ^ proposal when you have a moment? TY!

@melvin-bot melvin-bot bot added the Overdue label Mar 3, 2025
@M00rish
Copy link
Contributor

M00rish commented Mar 4, 2025

Proposal

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

Reports - Held expense disappears after approving pending expense from Reports

What is the root cause of that problem?

when report is approved with a held transactions, the held transaction is moved to a different report, so it disappears as the new report is not included in the current search data:

const data = useMemo(() => {
if (searchResults === undefined) {
return [];
}
return getSections(type, status, searchResults.data, searchResults.search, shouldGroupByReports);
}, [searchResults, status, type, shouldGroupByReports]);

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

add usEffect to check if a transaction has reportID changed, if so trigger new search to include the new report :

 useEffect(() => {
        if (!transactions || !previousTransactions) {
            return;
        }
    
        const hasReportChanged = Object.entries(transactions).some(([transactionID, transaction]) => {
            const previousTransaction = previousTransactions[transactionID];
            return previousTransaction && previousTransaction.reportID !== transaction?.reportID;
        });
    
        if (hasReportChanged) {
            search({queryJSON, offset: 0});
        }
    }, [transactions, previousTransactions, queryJSON]);

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

UI issue

What alternative solutions did you explore? (Optional)

N/A

Copy link

melvin-bot bot commented Mar 4, 2025

@thesahindia Whoops! This issue is 2 days overdue. Let's get this updated quick!

@dylanexpensify dylanexpensify moved this to Bugs and Follow Up Issues in #expensify-bugs Mar 4, 2025
@melvin-bot melvin-bot bot removed Help Wanted Apply this label when an issue is open to proposals by contributors Overdue labels Mar 4, 2025
@Christinadobrzyn
Copy link
Contributor

reassigning based on this Slack convo https://expensify.slack.com/archives/C02NK2DQWUX/p1741113791513709

@Christinadobrzyn
Copy link
Contributor

@parasharrajat can you check out the above proposals when you have a moment? TY!

@parasharrajat
Copy link
Member

Yes, reviewing it...

@parasharrajat
Copy link
Member

parasharrajat commented Mar 5, 2025

@LorenzoBloedow's proposal makes sense. We have a case where reportaction changes when dealing with transactions. We should add a comment to explain that as well.

🎀 👀 🎀 C+ reviewed

Copy link

melvin-bot bot commented Mar 5, 2025

Triggered auto assignment to @blimpich, see https://stackoverflow.com/c/expensify/questions/7972 for more details.

@parasharrajat
Copy link
Member

Sorry, tagged the wrong contributor earlier. Updated the comment.

@LorenzoBloedow
Copy link
Contributor

@parasharrajat Not sure if I'm supposed to, but I can't access the discussion, getting an error.

@parasharrajat
Copy link
Member

Unfortunately, it is internal.

LorenzoBloedow added a commit to LorenzoBloedow/Expensify that referenced this issue May 6, 2025
* Add unit tests
* Add warning comment
@Christinadobrzyn Christinadobrzyn added Internal Requires API changes or must be handled by Expensify staff External Added to denote the issue can be worked on by a contributor and removed External Added to denote the issue can be worked on by a contributor Internal Requires API changes or must be handled by Expensify staff labels May 6, 2025
@melvin-bot melvin-bot bot added the Help Wanted Apply this label when an issue is open to proposals by contributors label May 6, 2025
Copy link

melvin-bot bot commented May 6, 2025

Current assignee @parasharrajat is eligible for the External assigner, not assigning anyone new.

@melvin-bot melvin-bot bot added Daily KSv2 and removed Weekly KSv2 labels May 6, 2025
@Christinadobrzyn
Copy link
Contributor

monitoring #57887

@Christinadobrzyn
Copy link
Contributor

I think this should be weekly as we're reviewing #57887

Moving it back to weekly but let me know if that's not good.

@Christinadobrzyn Christinadobrzyn added Weekly KSv2 and removed Daily KSv2 Help Wanted Apply this label when an issue is open to proposals by contributors labels May 8, 2025
@Christinadobrzyn
Copy link
Contributor

monitoring #57887

Copy link

melvin-bot bot commented May 14, 2025

⚠️ Looks like this issue was linked to a Deploy Blocker here

If you are the assigned CME please investigate whether the linked PR caused a regression and leave a comment with the results.

If a regression has occurred and you are the assigned CM follow the instructions here.

If this regression could have been avoided please consider also proposing a recommendation to the PR checklist so that we can avoid it in the future.

@parasharrajat
Copy link
Member

No regression. That issue might be a follow-up here to the original PR.

@melvin-bot melvin-bot bot added Weekly KSv2 Awaiting Payment Auto-added when associated PR is deployed to production and removed Weekly KSv2 labels May 15, 2025
@melvin-bot melvin-bot bot changed the title [$250] Reports - Held expense disappears after approving pending expense from Reports [Due for payment 2025-05-22] [$250] Reports - Held expense disappears after approving pending expense from Reports May 15, 2025
Copy link

melvin-bot bot commented May 15, 2025

Reviewing label has been removed, please complete the "BugZero Checklist".

@melvin-bot melvin-bot bot removed the Reviewing Has a PR in review label May 15, 2025
Copy link

melvin-bot bot commented May 15, 2025

The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.45-21 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 2025-05-22. 🎊

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

Copy link

melvin-bot bot commented May 15, 2025

@parasharrajat @Christinadobrzyn @parasharrajat The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting Payment Auto-added when associated PR is deployed to production Bug Something is broken. Auto assigns a BugZero manager. External Added to denote the issue can be worked on by a contributor Weekly KSv2
Projects
Status: Bugs and Follow Up Issues
Development

No branches or pull requests

7 participants