App icon indicating copy to clipboard operation
App copied to clipboard

[$250] LHN- No GBR shown in LHN after cancelled payment instantly

Open IuliiaHerets opened this issue 1 year ago β€’ 13 comments

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

  1. Navigate to https://staging.new.expensify.com/
  2. Navigate to the submited expense notice a GBR in LHN
  3. Pay with elsewhere the expense and notice no more GBR in LHN
  4. 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

View all open jobs on GitHub

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 OwnerCurrent Issue Owner: @parasharrajat

IuliiaHerets avatar Nov 23 '24 15:11 IuliiaHerets

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.

melvin-bot[bot] avatar Nov 23 '24 15:11 melvin-bot[bot]

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

ghost avatar Nov 23 '24 15:11 ghost

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)

nkdengineer avatar Nov 25 '24 09:11 nkdengineer

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

melvin-bot[bot] avatar Nov 25 '24 15:11 melvin-bot[bot]

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

melvin-bot[bot] avatar Nov 25 '24 15:11 melvin-bot[bot]

@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

parasharrajat avatar Nov 27 '24 15:11 parasharrajat

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

melvin-bot[bot] avatar Nov 27 '24 15:11 melvin-bot[bot]

@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

ghost avatar Nov 27 '24 18:11 ghost

@francoisl Please take a look at this comment when you have a chance.

nkdengineer avatar Nov 29 '24 03:11 nkdengineer

πŸ“£ It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? πŸ’Έ

melvin-bot[bot] avatar Dec 02 '24 16:12 melvin-bot[bot]

I agree we should go with the solution that sets/resets all data correctly - going to assign @nkdengineer.

francoisl avatar Dec 02 '24 18:12 francoisl

πŸ“£ @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 πŸ“–

melvin-bot[bot] avatar Dec 02 '24 18:12 melvin-bot[bot]

Testing the PR. Trying to get the test steps clarified.

parasharrajat avatar Dec 07 '24 08:12 parasharrajat

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

melvin-bot[bot] avatar Dec 12 '24 01:12 melvin-bot[bot]

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)

melvin-bot[bot] avatar Dec 12 '24 01:12 melvin-bot[bot]

@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]

melvin-bot[bot] avatar Dec 12 '24 01:12 melvin-bot[bot]

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:

  1. Navigate to the submitted expense notice a GBR in LHN.
  2. Pay with elsewhere the expense and notice no more GBR in LHN
  3. Cancel the payment on the expense and navigate back to LHN
  4. GBR should be back on LHN.

Do we agree πŸ‘ or πŸ‘Ž

parasharrajat avatar Dec 12 '24 08:12 parasharrajat

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.

melvin-bot[bot] avatar Dec 13 '24 11:12 melvin-bot[bot]

I'm OOO Dec 16-20, adding a leave buddy

next steps:

  • make payment
  • regression test already added βœ”οΈ

sonialiap avatar Dec 13 '24 11:12 sonialiap

Not overdue. Payment is due on the 19th.

lschurr avatar Dec 16 '24 17:12 lschurr

Payment summary:

  • Contributor: @nkdengineer $250 paid via Upwork
  • Reviewer: @parasharrajat $250 - please request via NewDot

lschurr avatar Dec 19 '24 17:12 lschurr

Payment requested as per https://github.com/Expensify/App/issues/53024#issuecomment-2555154737

parasharrajat avatar Jan 19 '25 10:01 parasharrajat

$250 approved for @parasharrajat

JmillsExpensify avatar Jan 22 '25 21:01 JmillsExpensify