Skip to content

[HOLD for payment 2025-02-04] [$250] Expense - Edited amount for a paid request does not revert to paid amount when dismiss the error #54471

Closed

Description

@vincdargento

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: v9.0.77-6
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: N/A
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team

Action Performed:

  1. Navigate to staging.new.expensify.com.
  2. [User A] Request money from User B.
  3. [User A] Open IOU details page > Click Amount.
  4. [User B] Pay the request.
  5. [User A] Enter a new amount and save it.
  6. [User A] Close the error message.

Expected Result:

The amount in IOU details page should revert to the original amount after closing the error message (as in PR #32898)

Actual Result:

The amount in IOU details page does not revert to the original amount after closing the error message. It only reverts after refreshing the app.

Workaround:

Unknown

Platforms:

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

Screenshots/Videos

bug.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~021871573512679466358
  • Upwork Job ID: 1871573512679466358
  • Last Price Increase: 2025-01-07
  • Automatic offers:
    • Tony-MK | Contributor | 105631903
Issue OwnerCurrent Issue Owner: @bfitzexpensify

Activity

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

    @melvin-bot

    Triggered auto assignment to @bfitzexpensify (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. mkzie2 commented on Dec 23, 2024

    @mkzie2
    Contributor

    Edited by proposal-police: This proposal was edited at 2024-12-23 19:30:42 UTC.

    Proposal

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

    The amount in IOU details page does not revert to the original amount after closing the error message. It only reverts after refreshing the app.

    What is the root cause of that problem?

    We only update the pending field and error field of transactions in failureData. Then the updated data isn't reverted.

    App/src/libs/actions/IOU.ts

    Lines 2992 to 3000 in 2458635

    failureData.push({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
    value: {
    pendingFields: clearedPendingFields,
    isLoading: false,
    errorFields,
    },
    });

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

    We should revert to original transaction data and only override the pending field and error field. Or we can simply revert to transaction

    failureData.push({
        onyxMethod: Onyx.METHOD.MERGE,
        key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
        value: {
            ...transaction,
            pendingFields: clearedPendingFields,
            isLoading: false,
            errorFields,
        },
    });
    

    Or

    failureData.push({
        onyxMethod: Onyx.METHOD.MERGE,
        key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
        value: transaction,
    });
    

    App/src/libs/actions/IOU.ts

    Lines 2992 to 3000 in 2458635

    failureData.push({
    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`,
    value: {
    pendingFields: clearedPendingFields,
    isLoading: false,
    errorFields,
    },
    });

    We can check if getUpdateTrackExpenseParams has the same problem and fix it

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

    We must create a unit test for one of the update money request APIs, making the request fail. After that we need to verify the transaction data is reverted to the original value before the API is called.

    What alternative solutions did you explore? (Optional)

    NA

    Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.

  4. Tony-MK commented on Dec 23, 2024

    @Tony-MK
    Contributor

    Proposal

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

    Expense - Edited amount for a paid request does not revert to paid amount when dismissing the error

    What is the root cause of that problem?

    We are not returning the transaction amount figure back to the original amount and will take the figure from modifiedAmount since it is not empty.

    clearError={Transaction.clearError}

    So, we any clear the errors but we don't revert the transaction changes.

    function clearError(transactionID: string) {
    Onyx.merge(`${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, {errors: null, errorFields: {route: null, waypoints: null, routes: null}});
    }

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

    Create a new function for the clearError prop, over here, to revert the transaction data to the previous values depending on which field was attempted to change while calling Transaction.clearError.

    We will revert the transaction values from the report's modified Expense action originalMessage.

    clearError={
     (transactionID) => {
      // Revert the transaction values from reportAction.originalMessage
      Transaction.clearError(transactionID)
     }
    }
    

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

    Create a unit test for the new function to check if it can restore the previous values of the transaction even with different changes.

    What alternative solutions did you explore? (Optional)

    Let's update the failureData and add the previous values of the transaction, in this case, the amount, modified amount, etc...

  5. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Dec 24, 2024
  6. changed the title [-]Expense - Edited amount for a paid request does not revert to paid amount when dismiss the error[/-] [+][$250] Expense - Edited amount for a paid request does not revert to paid amount when dismiss the error[/+] on Dec 24, 2024
  7. melvin-bot commented on Dec 24, 2024

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

    @melvin-bot

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

  10. moved this to Bugs and Follow Up Issues in #expensify-bugson Dec 24, 2024
  11. hungvu193 commented on Dec 25, 2024

    @hungvu193
    Contributor

    Thanks for the proposals, everyone.
    Both proposals make sense to me.

    As described in the expected result, we should revert the edited amount after closing error message. Because of that I'm aligned with @Tony-MK 's proposal.

    🎀👀🎀

  12. 43 remaining items

  13. changed the title [-][$250] Expense - Edited amount for a paid request does not revert to paid amount when dismiss the error[/-] [+][HOLD for payment 2025-02-04] [$250] Expense - Edited amount for a paid request does not revert to paid amount when dismiss the error[/+] on Jan 28, 2025
  14. melvin-bot commented on Jan 28, 2025

    @melvin-bot

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

  15. melvin-bot commented on Jan 28, 2025

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 9.0.89-8 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-02-04. 🎊

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

  16. melvin-bot commented on Jan 28, 2025

    @melvin-bot

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

  17. moved this from Bugs and Follow Up Issues to Hold for Payment in #expensify-bugson Jan 28, 2025
  18. hungvu193 commented on Feb 3, 2025

    @hungvu193
    Contributor

    @mkzie2 Appreciate your input, I will review it and keep you posted.

    Both @Tony-MK and I tested and couldn't reproduce the bug you mentioned, so we decided to proceed with the PR. Thanks for your input anyway.

  19. hungvu193 commented on Feb 3, 2025

    @hungvu193
    Contributor

    BugZero Checklist:

    • [Contributor] Classify the bug:
    Bug classification

    Source of bug:

    • 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: I can't really find the offending PR of this issue, we can consider this is an improvement to the request money flow.

    • [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: N/A

    • [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.

    Test:

    1. Navigate to staging.new.expensify.com.
    2. [User A] Request money from User B.
    3. [User A] Open the IOU details page > Click Amount.
    4. [User B] Pay the request.
    5. [User A] Enter a new amount and save it.
    6. [User A] Close the error message.
    7. Verify that the amount will be reverted to the old amount.

    Do we agree 👍 or 👎

  20. bfitzexpensify commented on Feb 4, 2025

    @bfitzexpensify
    Contributor

    Payment summary:
    @hungvu193 to be paid $250 through NewDot Manual Requests
    @Tony-MK paid $250 via Upwork

  21. moved this from Hold for Payment to Done in #expensify-bugson Feb 4, 2025
  22. garrettmknight commented on Feb 11, 2025

    @garrettmknight
    Contributor

    $250 approved for @hungvu193

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

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions