[$250] LHN- No GBR shown in LHN after cancelled payment instantly
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.0.66-0 Reproducible in staging?: Y Reproducible in production?: Y Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team
Action Performed:
Prerequisite Create a workspace and send an expense
Steps
- Navigate to https://staging.new.expensify.com/
- Navigate to the submited expense notice a GBR in LHN
- Pay with elsewhere the expense and notice no more GBR in LHN
- Cancel the payment and navigate back to LHN
Expected Result:
There is a GBR as the expense is not paid anymore
Actual Result:
No GBR shown in LHN after cancelled payment instantly until you navigate back to the expense again
Workaround:
Unknown
Platforms:
- [x] Android: Standalone
- [x] Android: HybridApp
- [x] Android: mWeb Chrome
- [x] iOS: Standalone
- [x] iOS: HybridApp
- [x] iOS: mWeb Safari
- [x] MacOS: Chrome / Safari
- [x] MacOS: Desktop
Screenshots/Videos
https://github.com/user-attachments/assets/e28837c4-eacc-4922-afe5-cc09e16cfe5c
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021861071187794353184
- Upwork Job ID: 1861071187794353184
- Last Price Increase: 2024-12-02
- Automatic offers:
- nkdengineer | Contributor | 105163052
Issue Owner
Current Issue Owner: @parasharrajat
Triggered auto assignment to @sonialiap (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.
Edited by proposal-police: This proposal was edited at 2024-11-23 16:00:00 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
No GBR shown in LHN after cancelled payment instantly
What is the root cause of that problem?
We are showing GBR base on
https://github.com/Expensify/App/blob/3ebe8520d74c57a2fe9548b7d4307206e2b7c673/src/components/LHNOptionsList/OptionRowLHN.tsx#L118
We aren't updating hasOutstandingChildRequest to true in optimisticData to when we cancel payment
https://github.com/Expensify/App/blob/3ebe8520d74c57a2fe9548b7d4307206e2b7c673/src/libs/actions/IOU.ts#L7381-L7390
What changes do you think we should make in order to solve the problem?
Add hasOutstandingChildRequest: true to optimisticData when we call cancelPayment API
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`,
value: {
hasOutstandingChildRequest: true,
},
})
What alternative solutions did you explore? (Optional)
NA
Proposal
Please re-state the problem that we are trying to solve in this issue.
No GBR shown in LHN after cancelled payment instantly until you navigate back to the expense again
What is the root cause of that problem?
When we cancel a payment, we wrongly update this to failureData here. I think it was a mistake here, it should be updated in optimistic data to update hasOutstandingChildRequest to true then GBR can appear immediately.
https://github.com/Expensify/App/blob/81724d9b9d11fffe49478eecba1a6deee8c56210/src/libs/actions/IOU.ts#L7381-L7389
What changes do you think we should make in order to solve the problem?
This data should be updated in optimistic data and we will reset hasOutstandingChildRequest and iouReportID of chatReport in failureData
if (chatReport?.reportID) {
optimisticData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`,
value: {
hasOutstandingChildRequest: true,
iouReportID: expenseReport.reportID,
},
});
failureData.push({
onyxMethod: Onyx.METHOD.MERGE,
key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`,
value: {
hasOutstandingChildRequest: chatReport.hasOutstandingChildRequest,
iouReportID: chatReport.iouReportID,
},
})
}
https://github.com/Expensify/App/blob/81724d9b9d11fffe49478eecba1a6deee8c56210/src/libs/actions/IOU.ts#L7381-L7389
What alternative solutions did you explore? (Optional)
Job added to Upwork: https://www.upwork.com/jobs/~021861071187794353184
Triggered auto assignment to Contributor-plus team member for initial proposal review - @parasharrajat (External)
@Themoonalsofall's proposal looks good to me given that it is first and solves the problem. But @nkdengineer made a good point about resetting values properly, we should correct that too. I am more inclined towards @nkdengineer's proposal as they pointed out the mistake and fixing it.
@francoisl What do you think?
:ribbon: :eyes: :ribbon: C+ reviewed
Triggered auto assignment to @francoisl, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
@parasharrajat My solution is first and it also solves the problem in OP, @nkdengineer's solution is based on my solution and only adds 1 point
@francoisl Please take a look at this comment when you have a chance.
π£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πΈ
I agree we should go with the solution that sets/resets all data correctly - going to assign @nkdengineer.
π£ @nkdengineer π An offer has been automatically sent to your Upwork account for the Contributor role π Thanks for contributing to the Expensify app!
Offer link Upwork job Please accept the offer and leave a comment on the Github issue letting us know when we can expect a PR to be ready for review π§βπ» Keep in mind: Code of Conduct | Contributing π
Testing the PR. Trying to get the test steps clarified.
Reviewing label has been removed, please complete the "BugZero Checklist".
The solution for this issue has been :rocket: deployed to production :rocket: in version 9.0.74-8 and is now subject to a 7-day regression period :calendar:. Here is the list of pull requests that resolve this issue:
- https://github.com/Expensify/App/pull/53428
If no regressions arise, payment will be issued on 2024-12-19. :confetti_ball:
For reference, here are some details about the assignees on this issue:
- @parasharrajat requires payment through NewDot Manual Requests
- @nkdengineer requires payment automatic offer (Contributor)
@parasharrajat @sonialiap @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]
BugZero Checklist:
- [x] [Contributor] Classify the bug:
Bug classification
Source of bug:
- [ ] 1a. Result of the original design (eg. a case wasn't considered)
- [x] 1b. Mistake during implementation
- [ ] 1c. Backend bug
- [ ] 1z. Other:
Where bug was reported:
- [x] 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
- [x] 3d. QA
- [ ] 3z. Other:
-
[x] [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: https://github.com/Expensify/App/pull/34719/files#r1881673164
-
[ ] [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: NA
-
[x] [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.
-
[x] [BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/453205
Regression Test Proposal
Precondition:
- Create a workspace and send an expense
Test:
- Navigate to the submitted expense notice a GBR in LHN.
- Pay with elsewhere the expense and notice no more GBR in LHN
- Cancel the payment on the expense and navigate back to LHN
- GBR should be back on LHN.
Do we agree π or π
Triggered auto assignment to @lschurr (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.
I'm OOO Dec 16-20, adding a leave buddy
next steps:
- make payment
- regression test already added βοΈ
Not overdue. Payment is due on the 19th.
Payment summary:
- Contributor: @nkdengineer $250 paid via Upwork
- Reviewer: @parasharrajat $250 - please request via NewDot
Payment requested as per https://github.com/Expensify/App/issues/53024#issuecomment-2555154737
$250 approved for @parasharrajat