-
Notifications
You must be signed in to change notification settings - Fork 270
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: nuxtpicture placeholder #1396
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1396 +/- ##
==========================================
+ Coverage 62.20% 62.44% +0.23%
==========================================
Files 79 79
Lines 3593 3605 +12
Branches 391 401 +10
==========================================
+ Hits 2235 2251 +16
+ Misses 1328 1324 -4
Partials 30 30 ☔ View full report in Codecov by Sentry. |
if (mainSrc.value.sizes) img.sizes = mainSrc.value.sizes | ||
if (mainSrc.value.srcset) img.srcset = mainSrc.value.srcset | ||
if (mainSrc.value.src) img.src = mainSrc.value.src |
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.
I'm a bit worried that we end up loading more images than necessary. So, mainSrc
will load, but then if there is another src that better suits browser needs (e.g. avif/webp), this will swap in, and we will have downloaded twice as much image data as we need.
do you have any ideas for resolving that? maybe using a picture element as placeholder instead?
Closes #1160.
Adds placeholder behavior to NuxtPicture by initially setting the img element's src tag to the placeholder, waiting for the main src to load, and then showing the image.