Skip to content

[HOLD for payment 2024-01-25] [$500] Deleted IOU offline disappears after going online if it has already been paid for by another user. #33158

Closed

Description

@kbecciv

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: 1.4.13-0
Reproducible in staging?: y
Reproducible in production?: y
If this was caught during regression testing, add the test name, ID and link from TestRail:
Email or phone of affected tester (no customers):
Logs: https://stackoverflow.com/c/expensify/questions/4856
Expensify/Expensify Issue URL:
Issue reported by: Applause - Internal Team
Slack conversation:

Action Performed:

  1. Open New Expensify app or https://staging.new.expensify.com/
  2. Log in with separate accounts in the main testing device and a secondary device
  3. In the main testing device create an 2 IOU with a user
  4. Disable the internet connection in the main testing device
  5. On the main test device (offline), cancel one of the sent IOU
  6. In the secondary device (online), mark all IOU as paid with the "Pay elsewhere" option.
  7. Enable the internet connection in the main testing device
  8. On the main device, delete the error "Unexpected error deleting the money request, please try again later" in the IOU report

Expected Result:

Once the error has been removed, the primary device should display the paid IOU that failed to be removed.

Actual Result:

Deleted IOU offline disappears after going online if it has already been paid for by another user.

Workaround:

Unknown

Platforms:

Which of our officially supported platforms is this issue occurring on?

  • Android: Native
  • Android: mWeb Chrome
  • iOS: Native
  • iOS: mWeb Safari
  • MacOS: Chrome / Safari
  • MacOS: Desktop

Screenshots/Videos

Add any screenshot/video evidence

Bug6314527_1702644676009.Recording__944.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01fed1ad1953a51e12
  • Upwork Job ID: 1735648259511918592
  • Last Price Increase: 2024-01-09
  • Automatic offers:
    • hoangzinh | Reviewer | 28096820
    • bernhardoj | Contributor | 28096822

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Dec 15, 2023
  2. changed the title [-]Deleted IOU offline disappears after going online if it has already been paid for by another user.[/-] [+][$500] Deleted IOU offline disappears after going online if it has already been paid for by another user.[/+] on Dec 15, 2023
  3. melvin-bot commented on Dec 15, 2023

    @melvin-bot
  4. melvin-bot commented on Dec 15, 2023

    @melvin-bot

    Triggered auto assignment to @abekkala (Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details.

  5. added
    Help WantedApply this label when an issue is open to proposals by contributors
    on Dec 15, 2023
  6. melvin-bot commented on Dec 15, 2023

    @melvin-bot

    Bug0 Triage Checklist (Main S/O)

    • This "bug" occurs on a supported platform (ensure Platforms in OP are ✅)
    • This bug is not a duplicate report (check E/App issues and #expensify-bugs)
      • If it is, comment with a link to the original report, close the issue and add any novel details to the original issue instead
    • This bug is reproducible using the reproduction steps in the OP. S/O
      • If the reproduction steps are clear and you're unable to reproduce the bug, check with the reporter and QA first, then close the issue.
      • If the reproduction steps aren't clear and you determine the correct steps, please update the OP.
    • This issue is filled out as thoroughly and clearly as possible
      • Pay special attention to the title, results, platforms where the bug occurs, and if the bug happens on staging/production.
    • I have reviewed and subscribed to the linked Slack conversation to ensure Slack/Github stay in sync
  7. melvin-bot commented on Dec 15, 2023

    @melvin-bot

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

  8. namhihi237 commented on Dec 15, 2023

    @namhihi237
    Contributor

    Proposal

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

    Deleted IOU offline disappears after going online if it has already been paid for by another user

    What is the root cause of that problem?

    In here we only clear errors in the reportAction the pendingAction still delete
    So the IOU will hide because this condition

    const hideChildren = shouldHideOnDelete && !isOffline && pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE && !hasErrors;

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

    We should remove the pendingAction when clear the error message too.

       Onyx.merge(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${originalReportID}`, {
            [reportAction.reportActionID]: {
                errors: null,
                pendingAction: null,
            },
        });

    What alternative solutions did you explore? (Optional)

  9. bernhardoj commented on Dec 15, 2023

    @bernhardoj
    Contributor

    Proposal

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

    If we close the request/transaction delete error message, the report action also disappears, but it should stay visible.

    What is the root cause of that problem?

    When we delete the request, we optimistically set the pendingAction to DELETE.

    App/src/libs/actions/IOU.js

    Lines 2274 to 2276 in 275bd03

    const updatedReportAction = {
    [reportAction.reportActionID]: {
    pendingAction: shouldShowDeletedRequestMessage ? CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE : CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE,

    This will show the strikethrough text while offline. If we pay the request from the requested user, the delete action will fail when we come back online. If fails, the error message will show with a close button, but the DELETE pendingAction still exists.

    If the pendingAction is DELETE while online, the view should be hidden, but because we have an error message, the view is displayed.

    const hasErrors = isNotEmptyObject(errors ?? {});

    const hideChildren = shouldHideOnDelete && !isOffline && pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE && !hasErrors;

    So, once we press the close error message, the request view is hidden.

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

    We should clear the pendingAction when the delete fails.

    App/src/libs/actions/IOU.js

    Lines 2443 to 2450 in 275bd03

    onyxMethod: Onyx.METHOD.MERGE,
    key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.reportID}`,
    value: {
    [reportAction.reportActionID]: {
    ...reportAction,
    errors: ErrorUtils.getMicroSecondOnyxError('iou.error.genericDeleteFailureMessage'),
    },
    },

  10. abekkala commented on Dec 15, 2023

    @abekkala
    Contributor

    Dupe of 26511
    Closing

  11. 36 remaining items

  12. added and removed
    Help WantedApply this label when an issue is open to proposals by contributors
    on Jan 15, 2024
  13. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Jan 18, 2024
  14. changed the title [-][$500] Deleted IOU offline disappears after going online if it has already been paid for by another user.[/-] [+][HOLD for payment 2024-01-25] [$500] Deleted IOU offline disappears after going online if it has already been paid for by another user.[/+] on Jan 18, 2024
  15. melvin-bot commented on Jan 18, 2024

    @melvin-bot

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

  16. melvin-bot commented on Jan 18, 2024

    @melvin-bot

    The solution for this issue has been 🚀 deployed to production 🚀 in version 1.4.26-2 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 2024-01-25. 🎊

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

  17. melvin-bot commented on Jan 18, 2024

    @melvin-bot

    BugZero Checklist: The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed:

    • [@hoangzinh] The PR that introduced the bug has been identified. Link to the PR:
    • [@hoangzinh] 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:
    • [@hoangzinh] A discussion in #expensify-bugs 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:
    • [@hoangzinh] Determine if we should create a regression test for this bug.
    • [@hoangzinh] If we decide to create a regression test for the bug, please propose the regression test steps to ensure the same bug will not reach production again.
    • [@abekkala] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  18. abekkala commented on Jan 24, 2024

    @abekkala
    Contributor

    PAYMENTS FOR JAN 25

  19. hoangzinh commented on Jan 24, 2024

    @hoangzinh
    Contributor

    Regression Test Proposal

    I would like to borrow the Test steps of @bernhardoj in his PR here #34469

    1. [User A] Open chat with User B
    2. [User A] Request money twice to User B
    3. [User A] Turn off internet connection
    4. [User A] Delete one of the request
    5. [User B] Pay the money request
    6. [User A] Turn the internet connection back
    7. [User A] Verify you got an error on the request
    8. [User A] Close the error message
    9. [User A] Verify the error message disappears and the IOU is still visible

    Do we agree 👍 or 👎

  20. hoangzinh commented on Jan 24, 2024

    @hoangzinh
    Contributor

    BugZero Checklist:

  21. abekkala commented on Jan 25, 2024

    @abekkala
    Contributor

    @bernhardoj @hoangzinh payments sent and contracts ended - thank you! 🎉

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.ExternalAdded to denote the issue can be worked on by a contributorWeeklyKSv2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions