-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Add fallback icons for thumbnails #36214
fix: Add fallback icons for thumbnails #36214
Conversation
Hey @dannymcclain, I'd like to clarify a couple of things here: Do we want to keep the default thumbnails of the fixed size, or to adjust them to the image size? Even though the attachment might not be loaded, when uploading an attachment we set html meta attributes with the image size. For testing purposes, I show fallback when offline here, so you can see this approach keeps the thumbnails in fixed size while switching from a fallback to the real image: Screen.Recording.2024-02-09.at.11.00.11.movHowever, this might look quite ugly – every thumbnail is of a different size. |
Also, in your mockup I see you don't use any border – it will make the thumbnail blend in with the report action row on hover: However, they do look better without the border 🙂 WDYT @dannymcclain ? |
@paultsimura oh yeah good catch on the border—I think we should definitely include the border. As for this comment about the different sized thumbnails—I think we should do what you're doing and keep the fallback the same size as the thumbnail. I'm curious for the @Expensify/design team's thoughts but that makes the most sense to me, even if we end up with a bunch of different sized thumbnails. It feels more accurate and will likely create a smoother transition when going from offline > online. |
Yup, makes sense to me - I agree with Danny. |
Agreed. If it helps with reducing the jumping between offline and online, I'm all for it |
# Conflicts: # src/components/ReportActionItem/ReportActionItemImage.tsx # src/components/ReportActionItem/ReportActionItemImages.tsx
Hey @parasharrajat, this one is indeed tricky to test – I've collected some reproduction steps from the related bugs, but all of them are web-only, where you can edit the image source manually or disable caches. I cannot find a way to manually force an image to fail in the current system anymore (since the Distance receipt was fixed). e.g. #36061 cc: @quinthar as you've reported the issue I mentioned above – is there a way to force Concierge Compose to send a broken image? Or should we just use the steps you provided (manually modifying the source) to test the flow, and that's it? |
@parasharrajat 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] |
@parasharrajat all yours ✔️ |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeScreen.Recording.2024-02-15.at.2.10.02.AM.moviOS: NativeScreen.Recording.2024-02-15.at.2.06.56.AM.moviOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2024-02-15.at.1.11.59.AM.movMacOS: DesktopScreen.Recording.2024-02-15.at.1.20.25.AM.mov |
This is related to a fire/urgent issue, so I asked for a new C+ to test ASAP in Slack here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, pending C+ testing.
const onError = () => { | ||
Log.hmmm('Unable to fetch image to calculate size', {url}); | ||
onLoadFailure?.(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NAB: Should we provide default behavior to display a fallback image in this component?
On iOS Safari, the cloud icon never appears despite disabling cache. Screen.Recording.2024-02-15.at.1.33.13.AM.mov |
@allroundexperts for some reason, the "force offline" doesn't trigger this behavior on mWeb Safari for me either. However, if you turn off the wi-fi on your Mac, this will work. You could see the cloud icons on my safari recordings |
Weird enough, still doesn't work. Screen.Recording.2024-02-15.at.1.52.44.AM.mov |
Okay. Will continue on other devices for the meantime. |
@allroundexperts here's a fresh recording, maybe try the same sequence as I do: disable cache -> refresh page -> kill the wi-fi -> open the chat: Screen.Recording.2024-02-14.at.22.07.27-compressed.mp4 |
Still the same @paultsimura. I guess we can trust you on this one? Screen.Recording.2024-02-15.at.2.19.52.AM.mov |
This is super weird🤔 I guess the decision is up to you and the assigned Engineer |
I'll give it a try with testing IOS, @allroundexperts you may continue with the rest 🙏 |
An easy way to test this in dev is by replacing the lines: -- // const {html = '', text} = fragment;
++ const html = '<img src="a%20href=" alt="a href=" />';
++ const text = 'attachment'; here
|
Gotcha. Thanks. |
@aldo-expensify I've tested iOS native already and it works. |
@allroundexperts thanks, I ended up being able to test web and native in ios and both worked for me. Please finish the checklist so we can get this merged :) |
fix: Add fallback icons for thumbnails (cherry picked from commit 5a14fe1)
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Cherry-picked to staging by https://github.com/thienlnam in version: 1.4.41-9 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by https://github.com/thienlnam in version: 1.4.41-12 🚀
|
Details
Prevent the infinite loading for broken thumbnail images and show a fallback icon instead.
Fixed Issues
$ #34601
PROPOSAL: #34601 (comment)
Tests
Same as QA
Offline tests
Same as QA
QA Steps
message.html
, and set it to this string<img src=\"a%20href=\" alt=\"a href=\" />
For mobile browsers:
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Untitled-compressed.mp4
Android: mWeb Chrome
chrome-compressed.mp4
iOS: Native
Screen.Recording.2024-02-13.at.16.06.27-compressed.mp4
iOS: mWeb Safari
safari-compressed.mp4
MacOS: Chrome / Safari
Screen.Recording.2024-02-12.at.11.58.51-compressed.mp4
MacOS: Desktop
Screen.Recording.2024-02-14.at.00.51.36-compressed.mp4