Repository navigation
Description
Background
PR #97313 improved hover-to-zoom quality for non-PDF (image) receipts by deferring image loading and rendering the original full-resolution receipt image. As part of that change, image receipts got a progressive low-res → full-res transition: the low-res preview was drawn semi-transparent with a loading indicator while the full-res original loaded, then it switched to the sharp full-res image.
That transition was later removed. PR #97313 caused a deploy blocker — #98587 (Per diem expense receipt loads infinitely after reset app). PR #98668 resolved the blocker by restoring ImageWithLoading to be byte-identical to production, which reverted the three rendering changes that produced the transition:
- the preview being drawn with
opacitySemiTransparentinstead of full opacity - the removal of
isThumbnailLoading - the spinner condition change (
previewUri ? isLoading : isLoading && !isImageCached)
So today image receipts are back to the pre-#97313 rendering, and the low-res → full-res transition has not been added back.
Why it was reverted (the real root cause)
The infinite-loading regression was only exposed by #97313, not caused by it. The underlying bug is pre-existing: for some receipts the full-res .1024.jpg never emits onLoad or onError, so ImageWithLoading's isLoading state latches forever. On production ImageWithLoading stops showing the loading state once the low-res preview is on screen, so the latch renders as an ordinary thumbnail and nobody notices. #97313's semi-transparent-preview + permanent-spinner rendering made that latched state visible as an infinite loader (per-diem receipts after Clear cache and restart being one reproducible case).
What we want
Re-add the low-res → full-res progressive transition for image receipts (the intended UX from #97313), but in a way that does not reintroduce the infinite-loading regression — i.e. the loading state must not depend on the full-res image ever settling. Whoever picks this up should be able to reproduce the infinite per-diem receipt loading (steps in #98587) and confirm the new transition handles the never-onLoad/never-onError case gracefully (e.g. a timeout/fallback to the preview, or decoupling the spinner from the full-res load).
Relevant code
src/components/DeferredImageWithLoading.tsx(added in Defer image loading and use original receipt image #97313)src/components/ImageWithLoading.tsx(reverted in [CP Staging] fix Expense - Per diem expense receipt loads infinitely after reset app #98668)src/components/ReportActionItem/ReportActionItemImage.tsx
Reproducing the infinite per-diem receipt load
From #98587:
- Precondition: workspace has per diem rates.
- Create a per diem expense in a workspace chat.
- Account > Troubleshoot > Clear cache and restart > Reset and refresh.
- Go back to workspace chat and open the expense — the receipt should load (not spin forever).
Follow-up to #96999, requested in this comment.
Issue Owner
Current Issue Owner: @mallenexpensifyMetadata
Metadata
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
mountiny commentedon Aug 21, 2026
@bernhardoj do you want to work on this?
MelvinBot commentedon Aug 21, 2026
Proposal
What is the root cause of that problem?
Two things are tangled together here, so it helps to separate them.
1. Why there's no transition today. PR #98668 restored
ImageWithLoadingto the production rendering, which brought backisThumbnailLoading(ImageWithLoading.tsx:57) and the spinner gate atImageWithLoading.tsx:141. In this version the low-res preview is drawn at full opacity and the visible loading state is gated on the preview finishing (isThumbnailLoading), not on the full-res image finishing. So the low-res just gets silently swapped for the full-res with no "sharpening" cue.2. Why re-adding #97313's transition reintroduced the infinite loader. #97313 made the visible loading state (semi-transparent preview + spinner) depend on
isLoading, which only clears when the full-res.1024.jpgemitsonLoadoronError(seeImageWithLoading.tsx:126). For some receipts that image never emits either event (a still-generating derivative), soisLoadinglatchestrueforever — dimmed preview + permanent spinner. That latch is pre-existing; #97313 only made it visible. The per-diem-after-clear-cache case in #98587 is one reproducible instance.So the real constraint is: the visible loading/transition state must never depend on the full-res image settling, because it may never settle.
What changes do you think we should make in order to solve the problem?
Re-add the progressive transition in
ImageWithLoading, but treat the low-res preview as the always-visible base layer and the full-res image as an overlay that fades in on its ownonLoad:onLoadfires. If the full-res never firesonLoad/onError, the user is simply left looking at the readable low-res preview — no spinner latch, no infinite loader.isThumbnailLoading), never on the full-resisLoading. Keep the existingisThumbnailLoadingreset in thewaitForSessionpath (ImageWithLoading.tsx:135) so session-reload still behaves.This preserves the intended #97313 UX (low-res → sharp full-res) while making "never settles" a graceful no-op instead of an infinite loader. The wiring downstream is unchanged —
previewUrialready flows in from thethumbnail320derivative atReportActionItemImage.tsx:178throughReceiptImage→DeferredImageWithLoading.Validating it: the current production code no longer shows the infinite loader (it was reverted), so you can't reproduce it as-is. To prove the new transition is safe, recreate the never-
onLoad/never-onErrorcondition — either follow the per-diem steps from #98587 while temporarily reintroducing #97313's rendering, or block/throttle the.1024.jpgrequest in devtools so itsonLoadnever fires — and confirm the receipt settles on the readable low-res instead of spinning.Alternative solutions considered
isLoadingas Defer image loading and use original receipt image #97313 did, but add a timer that force-clears the visible loading state (falling back to the preview at full opacity) after N seconds. Simpler diff and keeps the exact original look, but it's a workaround — it still starts dependent on the full-res and only papers over the latch, so the base-layer approach above is preferred.Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/99199)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
view run
melvin-bot commentedon Aug 21, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @huult (
External)melvin-bot commentedon Aug 21, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
huult commentedon Aug 22, 2026
@bernhardoj Let me know if you still want to implement this.
bernhardoj commentedon Aug 22, 2026
I can't reproduce the infinite loading (onLoad not firing), @huult if you can, go ahead!
mukhrr commentedon Aug 22, 2026
@huult @bernhardoj I can reproduce this
99199-perdiem-repro-web.mp4
huult commentedon Aug 23, 2026
Okay, I’ll check it soon.
huult commentedon Aug 24, 2026
After reinstalling, I can’t reproduce the issue on the latest main. @mukhrr, can you still reproduce it?”
93 remaining items
melvin-bot commentedon Sep 15, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Sep 15, 2026
Payment Summary
Resolving PRs:
Fix receipt full-res image not loading when preview displaces it in flow #100423
Reviewer: @huult owed $250 via NewDot
Assignee: @neerajbachani requires payment (Needs manual offer from BZ)
BugZero Checklist (@mallenexpensify)
melvin-bot commentedon Sep 18, 2026
@mallenexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
mallenexpensify commentedon Sep 21, 2026
Payment Summary
Contributor: @neerajbachani paid $250 via Upwork
Contributor+: @huult due $250 via NewDot
@neerajbachani can you please accept the job below? Please reply here and tag me once you have.
https://www.upwork.com/jobs/~022102169556596757023
neerajbachani commentedon Sep 21, 2026
@mallenexpensify I've accepted the job offer, thanks!!
mallenexpensify commentedon Sep 21, 2026
@mallenexpensify paid, summary updated above. Thx.
JmillsExpensify commentedon Oct 14, 2026
$250 approved for @huult