Add caching for images with authentication on web#84409
Conversation
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
🚧 @Julesssss has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
|
Not repro, Windows 11 / Chrome, v9.3.31-4 PR:84409 07.03.2026_16.38.23_REC.mp4 |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ee2b8aea71
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@abdulrahuman5196 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ee2b8aea71
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
No product review needed |
|
Ready for C+ review, @abdulrahuman5196 |
|
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeScreen.Recording.2026-03-13.at.2.57.14.AM.moviOS: HybridAppiOS: mWeb SafariScreen.Recording.2026-03-13.at.2.50.26.AM.movMacOS: Chrome / SafariScreen.Recording.2026-03-13.at.2.32.54.AM.movScreen.Recording.2026-03-13.at.2.29.55.AM.mov |
ShridharGoel
left a comment
There was a problem hiding this comment.
Just one comment
Also, is it feasible to add tests for this?
|
There's a quick flicker when switching between images. Screen.Recording.2026-03-13.at.2.50.26.AM.mov |
|
@ShridharGoel I've imroved the error check (d091a81) and added tests (4a54622). As for the flickering, I've investigated it and overall the flickering happens cause we have additional preview for the transaction thread, I need to think how to handle it to not break anything. |
|
So should we handle the flickering here only or as a different task? |
I'm happy to push that to a follow up task, but lets leave that choice to @VickyStash |
|
🚧 @Julesssss has triggered a test Expensify/App build. You can view the workflow run here. |
|
I'm okay with handling it in a follow-up too! |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 @Julesssss has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/Julesssss in version: 9.3.38-0 🚀
|
|
Hi @VickyStash. QA team failed this PR on iOS with an original issue 1773662850776.84409-iOS.mp4 |
This PR updated web only. The native cache was added in this PR, and was deployed to prod a couple of weeks ago. I've just check ios prod app and there cache worked for me. |
|
@VickyStash not repro on prod 84409-iOS-Prod.mp4 |
|
🚀 Deployed to production by https://github.com/cristipaval in version: 9.3.38-4 🚀
|
I can't reproduce it on main (dev) either. @IuliiaHerets Have you followed any special steps? |
|
@VickyStash not repro now, seems it was a temporary issue ScreenRecording_03-16-2026.19-22-35_1.MP4 |
Explanation of Change
Adds a
useCachedImageSourcehook that uses the browser Cache API to persistently cache images fetched with auth headers on web.When a source has headers, the hook fetches the image, stores the response in a named cache (auth-images), and returns a blob URL without headers - bypassing expo-image's default fetch-per-render behavior. On subsequent mounts, the cached response is served instantly. Images without headers are passed through unchanged, as the browser's native HTTP cache already handles them.
Fixed Issues
$ #83112
PROPOSAL: N/A
Tests
Offline tests
Same, as Test steps
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same, as Test steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: mWeb Chrome
android_web.mp4
iOS: mWeb Safari
ios_web.mov
MacOS: Chrome / Safari
pr.mp4
web2.mp4