-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[$250][HOLDnecolas/react-native-web#2709] Tab - When switching tabs, the Custom Profile Avatar shows delayed #45853
Comments
Triggered auto assignment to @strepanier03 ( |
@strepanier03 FYI I haven't added the External label as I wasn't 100% sure about this issue. Please take a look and add the label if you agree it's a bug and can be handled by external contributors |
We think that this bug might be related to #vip-vsp |
Edited by proposal-police: This proposal was edited at 2024-08-08 03:11:24 UTC. ProposalPlease re-state the problem that we are trying to solve in this issue.The avatar image takes a couple of seconds to load What is the root cause of that problem?From here we can see that And in here, we never prefetch the avatar URL, hence the issue. What changes do you think we should make in order to solve the problem?To solve this issue in react-native-web library, we can simply cache the image after load in here the same way in here, making sure that the image is in the LOADED state for subsequent access from the parent component
Some extra consideration: We should even add a param in load function as well as the respective prop in the parent components to control the caching behavior. For example, we might don't want to cache the image naively this way if it is loaded from local file or when it goes with OUTDATED solution
We should add a mechanism in the
In here, we can control that we only prefetch for non-authenticated source, but we can extend later for authenticated-required source. What alternative solutions did you explore? (Optional)Even more exact solution on web, suggested here https://stackoverflow.com/questions/2446740/post-loading-check-if-an-image-is-in-the-browser-cache/50111407#50111407, we can utilize this logic to check and set the initial state correctly. To achieve that, update
We can easily verify that this logic work on web by opening the devtools > network tab and try toggle |
@strepanier03 Uh oh! This issue is overdue by 2 days. Don't forget to update your issues! |
Working on this now. |
Repro'd all good here. |
Job added to Upwork: https://www.upwork.com/jobs/~01ec9d563c4ff0e779 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @s77rt ( |
Isn't the image being cached? |
@dominictb After an image is loaded the first time it should be cached. Next time you render the same image it should load from the cache. Why this is not the case here? |
@s77rt it is true that once the image is loaded the first time, it is in the browser cache. But that doesn't mean this condition is true, and that means, the image is not shown as implemented here So, to show the image immediately, we need to make this condition to be true, i.e: Call |
@dominictb Sounds to me like a bug in RNW. If we overwrite the initial state to be |
@s77rt you can, but it might defeat the use case where we want to use |
@dominictb Will the image load correctly (from cache) in that case? (regardless of the placeholder) |
@s77rt yes. |
@dominictb In that case the bug should be fixed at RNW level |
@dominictb Adding the image uri to the cache entries makes sense to me but a better solution is to make use of the browser cache, that is to modify the |
@s77rt necolas/react-native-web#2709 upstream PR and linked issue are up |
@strepanier03 @s77rt @stitesExpensify @dominictb this issue is now 4 weeks old, please consider:
Thanks! |
Not overdue. Waiting on RNW PR feedback |
@strepanier03, @s77rt, @stitesExpensify, @dominictb Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Same ^ |
@stitesExpensify Let's make this |
This issue has not been updated in over 15 days. @strepanier03, @s77rt, @stitesExpensify, @dominictb eroding to Monthly issue. P.S. Is everyone reading this sure this is really a near-term priority? Be brave: if you disagree, go ahead and close it out. If someone disagrees, they'll reopen it, and if they don't: one less thing to do! |
Still on hold |
Put this in #quality. |
@dominictb Seems like the upstream PR needs your attention. Please provide a reproducer for the repo maintainers to test |
@s77rt thanks, I'll check and update the upstream PR as soon as possible |
@dominictb Is the bug no longer reproducible? Did you try with a custom avatar? |
@s77rt the original bug is no longer reproducible after #47041 is fixed. I have tried with custom avatar to confirm this. Nonetheless, the analysis in my proposal is correct, I figured a way to make it reproducible in the upstream but not so sure the improvement we introduced is significant enough. I'll make an update in the upstream PR and see what the author's final decision is. |
@s77rt after checking this, the correct root cause and fix of this issue should already covered by #47041, and I personally couldn't reproduce this in the upstream repo either. Even though necolas/react-native-web#2708 (comment) is correct and the upstream PR is a nice improvement, it might break the SSR support of the Image component, hence I don't think the upstream change is needed anymore. |
@dominictb If we have nothing to fix then let's do nothing |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.10-2
Reproducible in staging?: Y
Reproducible in production?: Y
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Issue reported by: Applause - Internal Team
Issue found when executing PR #45663
Action Performed:
PreCondition: User has a custom avatar added to their profile.
Expected Result:
User expects the Avatar image to load instantly upon changing tabs
Actual Result:
The avatar image blinks a takes a couple of seconds to load
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
Bug6548102_1721483392280.Avatar_shows_in_a_delayed_manner_when_switching_tabs_.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @s77rtThe text was updated successfully, but these errors were encountered: