-
Notifications
You must be signed in to change notification settings - Fork 142
Adopt lazy loading for Pic component #1626
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
Conversation
Thanks for investigating this. My concern was indeed around whether Other than that, wondering if we should document that lazy loading is used by default and provide a simple prop to disable this behaviour. Sometimes it might be preferable to load all the images in the document in one go for better ux. |
Sounds good to me! WDYT about adding a |
|
sounds good! |
ang-zeyu
left a comment
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.
Lgtm otherwise! 👍
What is the purpose of this pull request?
Resolves #1559
Overview of changes:
Use
loading=lazyattribute to defer loading of images for Pic componentsImage is only loaded lazily as seen in the video
https://user-images.githubusercontent.com/60393696/124390276-5bde0880-dd1d-11eb-9cc9-f972f4995ad0.mp4
Anything you'd like to highlight / discuss:
In the issue description, it was mentioned that the height/width resolution might have to be moved accordingly. I tried a few examples and it seems to work as normal on my side. Is this concern regarding the
computeWidthfunction? From what I googled online, the images are loaded once it reaches calculated distance from the viewport. (Source: https://web.dev/browser-level-image-lazy-loading/)Testing instructions:
Proposed commit message: (wrap lines at 72 characters)
Adopt lazy loading for Pic component
Checklist: ☑️