You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-06-08] Receipt loading is slow and should be faster #85875
When you open an expense, the receipt image is slow to load. After you capture a receipt and submit an expense, the image displays instantly from your local file - but once the API responds, the server sends back a remote URL which overwrites the local file path in Onyx. The app then has to download the exact same image it just uploaded, complete with auth headers, causing a loading spinner to appear for something the device already has.
Solution
A few angles to explore:
After the server responds and sets receipt.source to the remote URL, preserve the local file:// path in the client-side success data so Onyx doesn't get steamrolled by the server's version.
Alternatively, pre-populate the image cache with the local file bytes keyed to the remote URL, so the "download" is effectively instant.
Reduce the resolution/quality of images we store in general. Receipts might not necessarily need to be full camera resolution - a smaller file that's still readable would load much faster for everyone, not just on the device that took the photo (looking into this in parallel here).
As a separate improvement, we could show a low-res thumbnail immediately while the full image loads in the background for cases where the image genuinely needs to be fetched (e.g., viewing on a different device).
Please re-state the problem that we are trying to solve in this issue.
Receipt loading is slow and should be faster
What is the root cause of that problem?
When a scan expense is created, the optimistic transaction stores a local receipt URI (file:// or blob:), which renders instantly. After the API succeeds, server Onyx updates include a remote receipt URL and overwrite transaction.receipt.source. That forces a re-download (with auth), so the receipt briefly shows a loader even though the same bytes already exist locally.
What changes do you think we should make in order to solve the problem?
We should keep the local receipt URI on success for scan requests, so UI continues using the already-available local file instead of immediately switching to remote URL and re-fetching.
Add shouldPreserveLocalReceiptSource in buildOnyxDataForMoneyRequest
pendingFields: clearedPendingFields,
...(shouldPreserveLocalReceiptSource ? {receipt: {source: transaction.receipt?.source}} : {}),// The routes contains the distance in meters. Clearing the routes ensures we use the distance// in the correct unit stored under the transaction customUnit once the request is created.// The route is also not saved in the backend, so we can't rely on it.routes: null,},},
// The routes contains the distance in meters. Clearing the routes ensures we use the distance
// in the correct unit stored under the transaction customUnit once the request is created.
// The route is also not saved in the backend, so we can't rely on it.
routes: null,
},
},
and implement the same in buildOnyxDataForTrackExpense
What alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
adding changes only in optimisticData and/or successData is not sufficient because on OpenReport application will try to replace local url with server side URL and we will see this artefact:
first_attempt.mov
After we open created report the image disappears for a brief moment this may be caused because of Onyx:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
N/A - new feature
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
You should start testing on freshly logged in account and the best experience should be in incognito mode
Test:
Go to Spend page -> Transactions
Open one of Transaction with receipt
Observe if low res image is present for the moment a target image is loaded
Note: this fix aims primarily to improve performance for desktop web. It adds the functionality to iOS and Android platform but due to other factors the performance gain is not always visible.
Activity
samranahm commentedon Mar 19, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
Receipt loading is slow and should be faster
What is the root cause of that problem?
When a scan expense is created, the optimistic transaction stores a local receipt URI (file:// or blob:), which renders instantly. After the API succeeds, server Onyx updates include a remote receipt URL and overwrite transaction.receipt.source. That forces a re-download (with auth), so the receipt briefly shows a loader even though the same bytes already exist locally.
What changes do you think we should make in order to solve the problem?
We should keep the local receipt URI on success for scan requests, so UI continues using the already-available local file instead of immediately switching to remote URL and re-fetching.
shouldPreserveLocalReceiptSourceinbuildOnyxDataForMoneyRequestand add it with
here
App/src/libs/actions/IOU/index.ts
Lines 2284 to 2295 in 9fcd07a
and implement the same in
buildOnyxDataForTrackExpenseWhat alternative solutions did you explore? (Optional)
Reminder: Please use plain English, be brief and avoid jargon. Feel free to use images, charts or pseudo-code if necessary. Do not post large multi-line diffs or write walls of text. Do not create PRs unless you have been hired for this job.
sosek108 commentedon Mar 23, 2026
Hi, I'm Hubert from callstack and I can work on this issue
melvin-bot commentedon Mar 23, 2026
Whoops! This issue is 2 days overdue. Let's get this updated quick!
sosek108 commentedon Mar 24, 2026
@marcaaron Noone is assigned to this issue. Who should decide whether contributor or me should work on this issue?
sosek108 commentedon Mar 25, 2026
adding changes only in
optimisticDataand/orsuccessDatais not sufficient because on OpenReport application will try to replace local url with server side URL and we will see this artefact:first_attempt.mov
After we open created report the image disappears for a brief moment this may be caused because of Onyx:
source)sourceagain)melvin-bot commentedon Mar 25, 2026
Eep! 4 days overdue now. Issues have feelings too...
65 remaining items
Eskalifer1 commentedon Jun 3, 2026
BugZero Checklist:
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
N/A - new feature
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source 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: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal Template
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/646540
Regression Test Proposal
Precondition:
Test:
Note: this fix aims primarily to improve performance for desktop web. It adds the functionality to iOS and Android platform but due to other factors the performance gain is not always visible.
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-f7ff-ab0e-0727-ada93ff80cd4Eskalifer1 commentedon Jun 3, 2026
Just a heads-up: I'll be OOO from June 5 through June 14 and won't be available to review or follow up on this issue during that time.
melvin-bot commentedon Jun 7, 2026
Current assignee @mallenexpensify is eligible for the Awaiting Payment assigner, not assigning anyone new.
mallenexpensify commentedon Jun 8, 2026
Payment Summary
Contributor+: @Eskalifer1 paid $250 via Upwork.
@Eskalifer1 when you're back.... can you please accept the job below? Please reply here and tag me once you have.
https://www.upwork.com/jobs/~022064076372489569567
Eskalifer1 commentedon Jun 9, 2026
I was able to accept it today, thank you!
cc: @mallenexpensify
mallenexpensify commentedon Jun 9, 2026
@Eskalifer1 paid, summary updated above. Thx.