Skip to content

[HOLD for payment 2024-02-01] [$500] IOU – The receipt route image is blank after adding a stop in offline mode #34287

Closed

Description

@lanitochka17

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.24-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. Go to https://staging.new.expensify.com/
  2. Log in as the employee
  3. Navigate to a distance request details conversation
  4. Disable the internet connection
  5. Click on the distance item
  6. Add a new stop to the route and save
  7. Navigate to the report conversation

Expected Result:

After adding a stop in offline mode, the receipt route image should be pending, and the distance and amount should show as TBD

Actual Result:

The receipt route image is blank after adding a stop in offline mode

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

Bug6338024_1704911104598.receipt_route_image__is_blank.mp4

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~0164c29443ff05e829
  • Upwork Job ID: 1745155412648595456
  • Last Price Increase: 2024-01-10
  • Automatic offers:
    • shubham1206agra | Reviewer | 28101450
    • paultsimura | Contributor | 28101451

Activity

  1. added
    ExternalAdded to denote the issue can be worked on by a contributor
    BugSomething is broken. Auto assigns a BugZero manager.
    on Jan 10, 2024
  2. changed the title [-] IOU – The receipt route image is blank after adding a stop in offline mode[/-] [+][$500] IOU – The receipt route image is blank after adding a stop in offline mode[/+] on Jan 10, 2024
  3. melvin-bot commented on Jan 10, 2024

    @melvin-bot
  4. melvin-bot commented on Jan 10, 2024

    @melvin-bot

    Triggered auto assignment to @kadiealexander (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 Jan 10, 2024
  6. melvin-bot commented on Jan 10, 2024

    @melvin-bot

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

  7. paultsimura commented on Jan 10, 2024

    @paultsimura
    Contributor

    Proposal

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

    The pending distance request receipt is blank.

    What is the root cause of that problem?

    This started happening #33586 where we tried to define the local files instead of returning isLocalFile: true for all the receipts that didn't match the early-return criteria.

    This particular issue is happening because after a distance request is modified, we are waiting for the BE response to generate a new map snapshot to be used as a thumbnail here, and we optimistically use the URL of an image that still has to be generated on the BE, as a receipt. It looks like a normal image URL, not a local file.

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

    This pending distance request case is quite unique. For this, we already check the Distance transaction to not be pending (not have pending waypoints) here:

    if (!Object.hasOwn(transaction?.pendingFields ?? {}, 'waypoints')) {
    if (hasEReceipt) {
    return {thumbnail: null, image: ROUTES.ERECEIPT.getRoute(transaction.transactionID), transaction};
    }
    // For local files, we won't have a thumbnail yet
    if (isReceiptImage && (path.startsWith('blob:') || path.startsWith('file:'))) {
    return {thumbnail: null, image: path, isLocalFile: true};
    }
    if (isReceiptImage) {
    return {thumbnail: `${path}.1024.jpg`, image: path};
    }
    }

    We just need to add another check for the cases when the Distance request has a pending waypoint (the opposite check) and not wait until the final return, which will now return isLocalFile: false instead of true.

        if (Object.hasOwn(transaction?.pendingFields ?? {}, 'waypoints')) {
            return {thumbnail: null, image: ReceiptGeneric, isLocalFile: true};
        } else {
            if (hasEReceipt) {
                return {thumbnail: null, image: ROUTES.ERECEIPT.getRoute(transaction.transactionID), transaction};
            }
    
            // For local files, we won't have a thumbnail yet
            if (isReceiptImage && (path.startsWith('blob:') || path.startsWith('file:'))) {
                return {thumbnail: null, image: path, isLocalFile: true};
            }
    
            if (isReceiptImage) {
                return {thumbnail: `${path}.1024.jpg`, image: path};
            }
        }

    What alternative solutions did you explore? (Optional)

  8. FitseTLT commented on Jan 10, 2024

    @FitseTLT
    Contributor

    Proposal

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

    The receipt route image is blank after adding a stop in offline mode

    What is the root cause of that problem?

    When we update the waypoints we are not resetting the receipt on the transaction in onyx so it still exists so although in

    const isLocalFile = typeof path === 'number' || path.startsWith('blob:') || path.startsWith('file:') || path.startsWith('/');
    return {thumbnail: image, image: path, isLocalFile};

    we are returning the ReceiptGeneric thumbnail isLocalFile is not set to true as path is found from transaction?.receipt?.source which is not local so it will try to load it but fails as we are offline

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

    The right solution is to reset receipt of the transaction on saving waypoint in onyx b/c it is obsolate as we do for routes as in here

    // Clear the existing route so that we don't show an old route
    routes: {
    route0: {
    geometry: {
    coordinates: null,
    },
    },

    receipt: {
                source: ReceiptGeneric,
                state: CONST.IOU.RECEIPT_STATE.OPEN,
                receiptID: null,
            },
            filename: '',
    

    same as we are setting when creating a distance request

    App/src/libs/actions/IOU.js

    Lines 870 to 873 in 55746c7

    const optimisticReceipt = {
    source: ReceiptGeneric,
    state: CONST.IOU.RECEIPT_STATE.OPEN,
    };

    What alternative solutions did you explore? (Optional)

  9. shubham1206agra commented on Jan 13, 2024

    @shubham1206agra
    Contributor

    @paultsimura's proposal looks good to me.

    🎀 👀 🎀 C+ Reviewed

  10. melvin-bot commented on Jan 13, 2024

    @melvin-bot

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

  11. 7 remaining items

  12. paultsimura commented on Jan 16, 2024

    @paultsimura
    Contributor

    Thanks. The PR is ready for review: #34604

  13. added
    Awaiting PaymentAuto-added when associated PR is deployed to production
    and removed on Jan 25, 2024
  14. changed the title [-][$500] IOU – The receipt route image is blank after adding a stop in offline mode[/-] [+][HOLD for payment 2024-02-01] [$500] IOU – The receipt route image is blank after adding a stop in offline mode[/+] on Jan 25, 2024
  15. melvin-bot commented on Jan 25, 2024

    @melvin-bot

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

  16. melvin-bot commented on Jan 25, 2024

    @melvin-bot

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

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

  17. melvin-bot commented on Jan 25, 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:

    • [@shubham1206agra] The PR that introduced the bug has been identified. Link to the PR:
    • [@shubham1206agra] 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:
    • [@shubham1206agra] 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:
    • [@shubham1206agra] Determine if we should create a regression test for this bug.
    • [@shubham1206agra] 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.
    • [@kadiealexander] Link the GH issue for creating/updating the regression test once above steps have been agreed upon:
  18. kadiealexander commented on Feb 2, 2024

    @kadiealexander
    Contributor

    @shubham1206agra don't forget about the checklist please!

  19. kadiealexander commented on Feb 2, 2024

    @kadiealexander
    Contributor

    Payouts due:

    Upwork job is here.

  20. shubham1206agra commented on Feb 2, 2024

    @shubham1206agra
    Contributor

    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:

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

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions