You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[HOLD for payment 2024-12-11] [$250] Held expense - Empty message with reply appears after paying the unheld amount for second time #52696
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
Version Number: 9.0.63-3 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers):applausetester+kh051115@applause.expensifail.com Issue reported by: Applause Internal Team
Action Performed:
Go to staging.new.expensify.com
[User A] Submit two expenses to User B.
[User B] Hold the first expense.
[User B] Click Pay button and pay the unheld amount.
[User A] Submit another expense to User B.
[User B] Go to the expense report.
[User B] Click Pay button and pay the unheld amount.
[User B] Note that the held expense is marked as paid when it should be moved to another report.
[User B] Refresh the expense report.
[User B] Note that there is an empty message with reply which opens the held expense when clicked.
Expected Result:
In Step 8, the held expense should move to another report when only the pending amount is paid.
In Step 10, after refreshing the page, there should not be an empty message in the expense report.
Actual Result:
In Step 8, the held expense does not move to another report when only the pending amount is paid. The expense preview is marked as paid when only the unheld amount is paid.
In Step 10, after refreshing the page, there is an empty message in the expense report, which opens the held expense.
But the issue started to happen when we did it again the second time. It's because when we optimistically add the held expense to a new expense report, we set the pending action to add (as shown above). But we don't clear it when the request is successful. So, the pending action is always true and when we optimistically delete it, it will still be shown because a pending action is always shown.
changed the title [-]Held expense - Empty message with reply appears after paying the unheld amount for second time[/-][+][$250] Held expense - Empty message with reply appears after paying the unheld amount for second time[/+]on Nov 21, 2024
@DylanDylann@johncschuster@DylanDylann 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]
1a. Result of the original design (eg. a case wasn't considered)
1b. Mistake during implementation
1c. Backend bug
1z. Other:
Where bug was reported:
2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
2b. Reported on staging (eg. found during regression or PR testing)
2d. Reported on a PR
2z. Other:
Who reported the bug:
3a. Expensify user
3b. Expensify employee
3c. Contributor
3d. QA
3z. Other:
[Contributor] 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:
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
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
Activity
melvin-bot commentedon Nov 18, 2024
Triggered auto assignment to @johncschuster (
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.bernhardoj commentedon Nov 19, 2024
Proposal
Please re-state the problem that we are trying to solve in this issue.
The hold report action isn't removed from the paid expense chat and becomes empty when revisiting the report.
What is the root cause of that problem?
When we pay the expense report with held expense, it will optimistically remove the held expense and move it to the new optimistic expense report.
App/src/libs/actions/IOU.ts
Lines 6309 to 6331 in f77087f
But the issue started to happen when we did it again the second time. It's because when we optimistically add the held expense to a new expense report, we set the pending action to add (as shown above). But we don't clear it when the request is successful. So, the pending action is always true and when we optimistically delete it, it will still be shown because a pending action is always shown.
App/src/libs/ReportActionsUtils.ts
Lines 676 to 679 in f77087f
It becomes an empty message when we reopen it because the BE response changes the action to ADDCOMMENT instead of IOU.
What changes do you think we should make in order to solve the problem?
We need to clear the pending action when the request is successful.
We might need to do it for the optimistic report preview too because it also adds a pending action when created optimistically.
App/src/libs/actions/IOU.ts
Lines 6295 to 6302 in f77087f
We can do the same with other optimistic data that I missed.
melvin-bot commentedon Nov 21, 2024
Job added to Upwork: https://www.upwork.com/jobs/~021859730399211188082
[-]Held expense - Empty message with reply appears after paying the unheld amount for second time[/-][+][$250] Held expense - Empty message with reply appears after paying the unheld amount for second time[/+]melvin-bot commentedon Nov 21, 2024
Triggered auto assignment to Contributor-plus team member for initial proposal review - @DylanDylann (
External)melvin-bot commentedon Nov 25, 2024
@johncschuster, @DylanDylann Whoops! This issue is 2 days overdue. Let's get this updated quick!
22 remaining items
melvin-bot commentedon Dec 4, 2024
@DylanDylann @johncschuster @DylanDylann 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]
johncschuster commentedon Dec 4, 2024
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[Contributor] 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:
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Precondition:
Test:
Do we agree 👍 or 👎
johncschuster commentedon Dec 6, 2024
Payment Summary:
Contributor: @bernhardoj due $250 via NewDot
Contributor+: @DylanDylann paid $250 via Upwork
Upwork job here! Please apply
bernhardoj commentedon Dec 6, 2024
Requested in ND.
JmillsExpensify commentedon Dec 11, 2024
$250 approved for @bernhardoj
johncschuster commentedon Dec 11, 2024
Payment has been issued through Upwork. Thanks, everyone, for your contributions!
johncschuster commentedon Dec 11, 2024
Oh wait, I jumped the gun. @DylanDylann, can you please post the regression test steps if applicable?
DylanDylann commentedon Dec 11, 2024
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[Contributor] 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: Create optimistic report when approving/paying for report with hold expenses #42573 (comment)
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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:
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Test:
Do we agree 👍 or 👎