Repository navigation
Key native attachment thumbnails on the attachment ID so they stay on screen after send - #103527
Conversation
A freshly sent attachment renders the same picture from three URIs in a row: the picker path, the local cache copy once cacheAttachment finishes, then the remote thumbnail URL after AddComment returns. BaseImage keys the expo-image view on the URI, and expo-image clears the view every time that key changes, so the thumbnail goes blank twice per send on iOS and Android. BaseImageProps gets an optional recyclingKey. On native it replaces the URI-derived key; on web it is pulled out of the props so the spread cannot carry it through and web keeps its current key. ThumbnailImage and ImageWithSizeCalculation pass it down one level, and ImageRenderer keys attachment thumbnails on their attachment ID. Plain markdown images have no attachment ID and keep the URI key.
Expensify-hosted markdown images pass the attachment-or-receipt URL check without a data-expensify-source attribute, so they were getting keyed on the positional ID from getHtmlWithAttachmentID. Editing such a message to point at a different picture at the same position would have kept the old frame while the new one loaded. Key on the ID only when the image carries the uploaded attachment attribute.
tests/README.md asks for the three sections in every test.
|
@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] |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
🚧 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.
garrettmknight
left a comment
There was a problem hiding this comment.
Looks good from a product perspective.
|
@MelvinBot review |
Code reviewThe change looks correct and well scoped. I found no blocking issues. All CI checks pass except the reviewer checklist. What I verified
Minor (non-blocking)
Tests
|
|
@abdulrahuman5196 MelvinBot's review came back clean and garrett approved the product side. could you fill in the reviewer checklist when you get a chance? |
|
hey @Julesssss, this one has been waiting on the reviewer checklist for about a week now. garrett approved it and MelvinBot's review came back clean, and CI is green apart from the checklist. would you mind checking in with @abdulrahuman5196? and if he's tied up, could another C+ pick up the checklist? thanks a lot! |
|
Hi sorry for the delay checking now |
|
@yuvrajangadsingh The code looks good. Kindly fix the merge conflicts, I can work on platform specific checks then. |
…ecyclingkey # Conflicts: # src/components/ImageWithSizeCalculation.tsx
|
@abdulrahuman5196 thanks! merged main and fixed the conflict in |
|
checking now |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroidHybrid-0-Screen_Recording_2026-10-20_at_10.50.43.PM.movAndroid: mWeb ChromeandroidMWeb-0-Screen_Recording_2026-10-20_at_10.56.18.PM.moviOS: HybridAppiosHybrid-0-Screen_Recording_2026-10-20_at_10.31.56.PM.moviOS: mWeb SafariiosMWeb-0-Screen_Recording_2026-10-20_at_10.37.12.PM.movMacOS: Chrome / SafarimacOS-0-Screen_Recording_2026-10-20_at_9.59.04.PM.mov |
abdulrahuman5196
left a comment
There was a problem hiding this comment.
Changes looks good and works well. Reviewers checklist is also complete.
All yours. @Julesssss
🎀 👀 🎀
C+ Reviewed
|
🚧 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! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/Julesssss in version: 9.5.16-0 🚀
|
|
No help site update needed. This PR fixes a native rendering bug where a sent image thumbnail briefly went blank. It doesn't add a feature, rename anything, or make any help article sentence incorrect. |
|
🚀 Deployed to staging by https://github.com/Julesssss in version: 9.5.18-0 🚀
|
|
No help site update needed. This PR is a native bug fix that stops a newly sent image thumbnail from briefly going blank while it uploads. The app now behaves the way users already expect, so no article sentence is now incorrect. |
|
🚀 Deployed to production by https://github.com/grgia in version: 9.5.18-1 🚀
Bundle Size Analysis (Sentry): |
Explanation of Change
A freshly sent attachment can render the same picture from up to three URIs in a row: the picker path, the local cache copy once
cacheAttachmentfinishes, then the remote thumbnail URL afterAddAttachmentreturns.BaseImagekeys the expo-image view on the URI, and expo-image clears the view every time that key changes, so the thumbnail goes blank at each switch on iOS and Android.BaseImagePropsgets an optionalrecyclingKey. On native it replaces the URI-derived key, so the view keeps its last frame while the next source loads. On web it is pulled out of the props so the spread cannot carry it through, and web keeps its current key.ThumbnailImageandImageWithSizeCalculationpass it down one level, andImageRendererkeys thumbnails on their attachment ID only for uploaded attachments (the ones carryingdata-expensify-source). This is narrower than the proposal'sisAttachmentOrReceipt: a markdown image pointing at an Expensify receipt or chat-attachment URL passes that check too, but its ID is the positional onegetHtmlWithAttachmentIDadds, which an edit can reuse for a different picture. Those images, like every other markdown image, keep the URI key.Image's memo comparator now also comparesrecyclingKey, so a key change reaches the view even when the source object is reused.This stops the clearing on a key change on native. Web keeps its URI key, so the short loading placeholder web shows when the source switches is unchanged by this PR (visible in the web recordings below). It also does not change what happens when the image unmounts (expired auth token) or when a load fails (fallback icon).
Fixed Issues
$ #101928
PROPOSAL: #98624 (comment)
Tests
) and verify it renders as before.) and verify the fallback icon shows.Console errors on the local dev web build are pre-existing (React dev prop warnings, nested button hydration warning, fingerprint CORS noise from the local proxy). None come from the changed files.
Offline tests
QA Steps
Same as tests.
Checked on web with Troubleshoot > Force offline: while offline the console only shows the failed network requests you get offline, and after switching back it shows the same pre-existing warnings as above. None come from the changed files.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionTested on iOS native (simulator) against the production API with a high-traffic account: the Inbox and the high-traffic workspace chat opened with no loading state, and a sent picture's thumbnail painted right away and stayed on screen until I left the chat. Android and web were not re-run with that account.
Avatar, 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.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: Native
101928-android-native.mp4
Second send, different picture:
101928-android-second.mp4
Android: mWeb Chrome
101928-android-mweb.mp4
iOS: Native
101928-ios-native-small.mp4
Second send, different picture:
101928-ios-second-small.mp4
iOS: mWeb Safari
101928-ios-mweb-small.mp4
MacOS: Chrome / Safari
101928-web-chrome.mp4