owid / owid-grapher

A platform for creating interactive data visualizations
https://ourworldindata.org
MIT License
1.35k stars 227 forks source link

Homepage article thumbnails are full sized #3590

Closed ikesau closed 1 month ago

ikesau commented 1 month ago

For some reason, the homepage article thumbnails are loading the source image instead of the resized source. This is a waste of bandwidth and is probably hurting our core web vitals score.

https://github.com/owid/owid-grapher/assets/11844404/99676b7b-1f8f-4e6c-a9e2-cea70551cc83

toni-sharpe commented 1 month ago

That's not what I'm getting, below is FireFox and Chrome, same video as above, cache disabled in the inspector with inspector open so it's definitely affecting the page, plus a cmd+shift+R full cache reload performed before each video (so I have the latest live version and haven't got a cache primed with pre-error content).

Firefox - shows 850px (accidentally at 150%)

I noticed I was zoomed in in FireFox, so corrected that but the 150% vid shows 850px - very odd (and not so good, zooming should trigger mobile breakpoints and therefore load smaller images)

https://github.com/owid/owid-grapher/assets/10499070/4e9cc9c3-405f-40ab-9610-5e1dec16bce5

Firefox - shows 350px (defaulted to 100%)

https://github.com/owid/owid-grapher/assets/10499070/3bc3d8ed-dc68-4130-b162-ee6df126a8d1

Chrome - shows 350px

https://github.com/owid/owid-grapher/assets/10499070/27ec1e3e-92a3-4474-b4b6-29cd4665a813

I've noticed some more modern image types, picture tags, srcsets and other good perf. stuff, and not dug in at all, but it's not as easy as an img tag, regardless, and browsers don't behave alike, necessarily. Maybe that's somewhere to look?

This article comes from the Calibre perf. newsletter, maybe it is useful.

Locally images aren't loading for me (yet) so I'll need to fix that first to look really deeply.

marcelgerber commented 1 month ago

Yep, can confirm that this is also not happening for me. Neither in Firefox nor in Chrome.

ikesau commented 1 month ago

Ah sorry everyone, I fixed this in #3487 yesterday, forgot to link this issue. Thanks for the support 🙂

https://github.com/owid/owid-grapher/pull/3487/commits/4e25054581c5eef1dfe727a4771291107898a9f2#diff-66cf2bf35b952b9935f6f2b4557fc3872c89e4ddad51a64d5e9eb0f049f8ab38R77