Skip to content

[HOLD for payment 2024-04-05] [$500] Android - if you go offline, create a manual request and upload a receipt, and go online, the receipt disappears #38224

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.51
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 offline
  2. Upload the PDF receipt
  3. Open the PDF receipt preview. It will show the local PDF file
  4. Go online
  5. Wait for a few seconds (~20-30 seconds) until the upload completes. It will try to show the uploaded remote PDF file
  6. But fails, so you will see Failed to load PDF

Expected Result:

When user taps receipt, the pdf file must be displayed without any error

Actual Result:

When you come back online, the receipt disappears or generates an error

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

Bug6410589_1710213560733.failed.mp4

default-file-icon (12)

View all open jobs on GitHub

Upwork Automation - Do Not Edit
  • Upwork Job URL: https://www.upwork.com/jobs/~01a9ecdd65c6fb75a2
  • Upwork Job ID: 1768536207787233280
  • Last Price Increase: 2024-03-15
  • Automatic offers:
    • cubuspl42 | Reviewer | 0
    • bernhardoj | Contributor | 0

Activity

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

    @melvin-bot

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

  3. lanitochka17 commented on Mar 13, 2024

    @lanitochka17
    Author

    @jliexpensify FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors

  4. bernhardoj commented on Mar 13, 2024

    @bernhardoj
    Contributor

    Proposal

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

    Failed to load PDF shows while previewing a recently uploaded PDF as a receipt.

    What is the root cause of that problem?

    When we first preview the PDF receipt, it's still a local file. isAuthTokenRequired is false in this case. When the API to add the receipt completes, the receipt source is updated to the remote file. This will update both source and isAuthTokenRequired props.

    <AttachmentModal
    source={imageSource}
    isAuthTokenRequired={!isLocalFile}

    Then, we pass it to the attachment view.

    <AttachmentView
    // @ts-expect-error TODO: Remove this once Attachments (https://github.com/Expensify/App/issues/24969) is migrated to TypeScript.
    containerStyles={[styles.mh5]}
    source={sourceForAttachmentView}
    isAuthTokenRequired={isAuthTokenRequired}

    The problem is, the source is coming from the source state

    const sourceForAttachmentView = sourceState || source;

    which is updated every time the source props is updated.

    useEffect(() => {
    setSourceState(() => source);
    }, [source]);

    So, the isAuthTokenRequired is already true, but the source is still local file because the state is not updated yet. That's why the error appears.

    Screenshot 2024-03-13 at 22 22 15

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

    Instead of passing the isAuthTokenRequired props, we can pass isAuthTokenRequiredState which is also updated every time the props change.

    useEffect(() => {
    setIsAuthTokenRequiredState(isAuthTokenRequired);
    }, [isAuthTokenRequired]);

    What alternative solutions did you explore? (Optional)

    Prioritize the source props instead of source state

    const sourceForAttachmentView = sourceState || source;

    const sourceForAttachmentView = source || sourceState;
    
  5. jliexpensify commented on Mar 14, 2024

    @jliexpensify
    Contributor

    PDF attachments are working perfectly for me on v1.4.51-3 (Pixel 3a)

    @lanitochka17 Please re-test this

  6. jliexpensify commented on Mar 14, 2024

    @jliexpensify
    Contributor

    @bernhardoj also if you could retest and share a video, that would be great too!

  7. bernhardoj commented on Mar 14, 2024

    @bernhardoj
    Contributor

    Sure, here is the video.

    Screen.Recording.2024-03-14.at.18.57.05.mov

    You can use any PDF and please try to open the preview right after you upload it. This way, you will see the PDF preview of the local file. After the API completes, BE will return the remote file of the PDF and the app fails to switch to the remote file preview.

  8. jliexpensify commented on Mar 14, 2024

    @jliexpensify
    Contributor

    Hmm that's not what I'm seeing on a real device, on the newest version of production. Do you have a physical device for testing this one?

  9. bernhardoj commented on Mar 14, 2024

    @bernhardoj
    Contributor

    Same.

    Screenrecorder-2024-03-14-19-56-40-704.1.mp4

    Just to make sure, you are previewing the PDF receipt right? (not the regular chat attachment)

  10. jliexpensify commented on Mar 14, 2024

    @jliexpensify
    Contributor

    @lanitochka17 - you say this:

    1. Upload a pdf (below attached)

    But there's no PDF in the GH?

    @bernhardoj - are you using any random PDF? Because I am, so just wondering if it's a specific to a PDF?

  11. francoisl commented on Mar 14, 2024

    @francoisl
    Contributor

    I can't repro either on a Pixel 6 (app v 1.4.52-5), tested with 2 different random PDFs.

  12. jliexpensify commented on Mar 14, 2024

    @jliexpensify
    Contributor

    At this point, after discussing with @francoisl I am inclined to close this. @lanitochka17 please confirm if this issue is occurring with a specific PDF. @bernhardoj - same with you: if you can share your PDF, I can re-test.

  13. 55 remaining items

  14. changed the title [-][$500] Android - if you go offline, create a manual request and upload a receipt, and go online, the receipt disappears[/-] [+][HOLD for payment 2024-04-05] [$500] Android - if you go offline, create a manual request and upload a receipt, and go online, the receipt disappears[/+] on Mar 29, 2024
  15. melvin-bot commented on Mar 29, 2024

    @melvin-bot

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

  16. melvin-bot commented on Mar 29, 2024

    @melvin-bot

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

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

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

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

    @jliexpensify
    Contributor

    Back, removing Kadie!

  19. jakub-trzebiatowski commented on Apr 5, 2024

    @jakub-trzebiatowski
    Contributor
    • The PR that introduced the bug has been identified. Link to the PR:
      • It seems that the bug was present in the relevant components since they were created
    • 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:
      • N/A
    • 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:
      • No need for additional discussion
    • Determine if we should create a regression test for this bug.
      • Up to the QA team
    • 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.
      • Create a manual request.
      • Open the request transaction thread.
      • Switch to offline mode.
      • Add a PDF receipt.
      • Click on the receipt preview to open the attachment page.
      • Return to online mode.
      • Wait for a few seconds until the attachment reloads.
      • Ensure the PDF receipt is properly displayed, and not the "Failed to load PDF" message.
  20. jliexpensify commented on Apr 5, 2024

    @jliexpensify
    Contributor

    Dammit Upworks closed the job.

    PAYMENT SUMMARY

    NEW Upwork job - please accept!

  21. jliexpensify commented on Apr 8, 2024

    @jliexpensify
    Contributor

    Bump @cubuspl42 to accept so I can pay everyone please.

  22. jakub-trzebiatowski commented on Apr 8, 2024

    @jakub-trzebiatowski
    Contributor

    @jliexpensify Accepted 👍

  23. jliexpensify commented on Apr 8, 2024

    @jliexpensify
    Contributor

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

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions