Skip to content

97313 - Android - Receipt - Large receipt image stays lower-res #98566

Closed

Description

@applause-bot

If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.


Version Number: 9.4.53-1
Reproducible in staging?: Yes
Reproducible in production?: Yes
If this was caught during regression testing, add the test name, ID and link from BrowserStack: #97313
Email or phone of affected tester (no customers): N/A
Issue reported by: Applause Internal Team
Bug source: Pull Request QA execution
Device used: Android 16 / Samsung Galaxy A06
App Component: Money Requests

Action Performed:

Prerequisite: have large receipt images

  1. Open Expensify app
  2. Open the expense with large receipt image from Spend tab
  3. Observe the receipt image

Expected Result:

Original image is shown after the loading is done

Actual Result:

Low-res image is still shown after the loading is done

Workaround:

Unknown

Platforms:

  • Android: App
  • Android: mWeb Chrome
  • iOS: App
  • iOS: mWeb Safari
  • iOS: mWeb Chrome
  • Windows: Chrome
  • MacOS: Chrome Safari

Screenshots/Videos

Bug7232491_1786613645887.ceb712d3-a7fd-44ea-bc6f-1f2383ed67fc.mp4
Image

View all open jobs on GitHub

Applause Internal Information
Exported by: Julia Ponikarchuk
Bug ID: 7232491

Upwork Automation - Do Not Edit

Activity

  1. added
    BugSomething is broken. Auto assigns a BugZero manager.
    on Aug 13, 2026
  2. MelvinBot commented on Aug 13, 2026

    @MelvinBot
    Contributor

    Proposal

    TL;DR: PR #97313 switched the expanded receipt's primary image from the server-resized thumbnail to the full-size original. On Android the large original can fail to finish decoding, and because of how the two loading states are wired, the low-res preview is never removed — so you keep seeing the low-res image even though "loading" has visibly finished.

    What is the root cause of that problem?

    There are two independent loading states, and after PR #97313 the outer one is satisfied by the preview while the inner one waits on the original:

    • Outer state — MoneyRequestReceiptView owns isLoading, which drives the loading skeleton (showBorderlessLoading) and is cleared by the onLoad/onLoadFailure it passes down (MoneyRequestReceiptView.tsx:697-698).
    • Inner state — ImageWithLoading owns its own isLoading, which gates the semi-transparent low-res preview overlay. This inner state is cleared only when the always-mounted main <Image source={original}> fires onLoad or onError (ImageWithLoading.tsx:108-132 → imageLoadedSuccessfully → setIsLoading(false)).

    The preview <Image>'s onLoad is wired straight to the parent passthrough, not to the inner setIsLoading(false) (ImageWithLoading.tsx:100-102). So the sequence for a large receipt is:

    1. Expanded receipt (fillSpace) ⇒ shouldUseThumbnailImage=false ⇒ source = originalImageSource, previewUri = low-res (ReportActionItemImage.tsx:194, non-thumbnail branch ReceiptImage/index.tsx:251-272).
    2. The small low-res preview decodes quickly → fires parent onLoad → outer skeleton disappears ("loading done").
    3. The large original never completes decode on Android (nor errors) → inner setIsLoading(false) never runs → the semi-transparent low-res preview stays mounted indefinitely.

    Before PR #97313 the main image was itself the server-resized thumbnail, so it always decoded and cleared its own loading state; the original was only fetched lazily for hover-zoom. Moving the full original into the always-rendered main image is what exposes Android's large-bitmap decode limit.

    One decisive step is unverified: whether Android/expo-image fires neither onLoad nor onError for the oversized original (a silent stall). The reported symptom (low-res persists rather than going blank) matches "neither fires", but this should be confirmed on-device before implementing.

    Supporting evidence & verification
    • Preview overlay + inner spinner are gated purely on inner isLoading — ImageWithLoading.tsx:94-138.
    • Outer skeleton showBorderlessLoading = isLoading && fillSpace — MoneyRequestReceiptView.tsx:544.
    • The preview only shows while inner isLoading is true, so the fact that it persists proves isLoading is stuck true — i.e. the main original started (onLoadStart fired) but never completed. If onError were firing instead, the preview would unmount and you'd see a blank/fallback, not the low-res image.
    • No allowDownscaling / maxSourceResolution guard exists anywhere in the Image stack (Image/BaseImage.native.tsx), so the full-resolution bitmap is handed to Glide as-is. Android's per-bitmap texture/memory ceiling (commonly ~4096–8192 px, plus heap) is the likely stall point for "large receipt images".

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

    The core fix is to stop depending on the full original decoding successfully as the always-rendered image on native, and/or to break the stuck state. Options, roughly in order of preference:

    1. Cap/downscale the native original. Pass a decode resolution cap to the underlying expo-image (e.g. allowDownscaling / maxSourceResolution, or a recyclingKey-safe max dimension) in the Image native wrapper so Android can always decode it. This preserves the "use original" goal for web hover-zoom while keeping native robust.
    2. Guarantee the preview is dismissible. Don't leave the inner isLoading gated solely on the original's onLoad/onError. Add a fallback (timeout, or treat a decoded preview as "good enough" to drop the overlay) so a silently-stalled original can't pin the low-res overlay forever.
    3. Fall back to the thumbnail on native for the expanded view (keep the original-source behavior for web only), since the reported regression is Android-specific.

    What alternative solutions did you explore? (Optional)

    Reverting the ReportActionItemImage.tsx:194 source swap would fix the regression but reopen #96999 (the hover-zoom quality issue PR #97313 was solving), so it's not preferred.

    Possibly related (same PR #97313)


    Next Steps for Contributor+ team:
    To accept: @MelvinBot implement [this](https://github.com/Expensify/App/issues/98566) to create a draft PR.
    To refine: @MelvinBot <your feedback>
    To reject: Explain why you are rejecting Melvin's proposal.

  3. added
    ExternalAdded to denote the issue can be worked on by a contributor
    on Aug 13, 2026
  4. melvin-bot commented on Aug 13, 2026

    @melvin-bot

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

  5. melvin-bot commented on Aug 13, 2026

    @melvin-bot
  6. bernhardoj commented on Aug 13, 2026

    @bernhardoj
    Contributor

    My bad. This is expected. The original image is only shown on the wide RHP page (which is only available on a large screen).

  7. mountiny commented on Aug 13, 2026

    @mountiny
    Contributor

    cc @Expensify/design are you fine with this as a consequence of the changes to the lazy load?

  8. dannymcclain commented on Aug 13, 2026

    @dannymcclain
    Contributor

    I mean, it looks absolutely awful, but this does feel pretty edge-casey to me. Curious what the rest of the team thinks, but I'm inclined to not optimize for receipt images like this.

  9. shawnborton commented on Aug 13, 2026

    @shawnborton
    Contributor

    Haha have we ever had a customer upload a receipt like this?! Feels very edge casey so I could live with it.

  10. bernhardoj commented on Aug 13, 2026

    @bernhardoj
    Contributor

    are you fine with this as a consequence of the changes to the lazy load?

    This is only on a small screen and is an existing behavior in prod. The lazy load is only implemented for the original image resolution, available on a large screen only.

  11. trjExpensify commented on Aug 13, 2026

    @trjExpensify
    Contributor

    Big shop at CVS? 😂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

BugSomething 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