Skip to content
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

do not use raw url in srcset #3448

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

do not use raw url in srcset #3448

wants to merge 2 commits into from

Conversation

JLarky
Copy link
Contributor

@JLarky JLarky commented Jul 26, 2024

Description

Sorry for the fly by PR :) I think I'm probably brigning this up more like a discussion than a proper PR. I've beein looking into image performance issues with builder content and the thing that I noticed is that you are putting raw url in the srcset without adding 1x or 1w attributes. Those images are showing up in the Properly size images Potential savings of xxx KiB report of lighthouse (especially on the desktop). I think the proper solution according to all the standards and docs is to use intrinsic size of the image, so let's say I have an image of 1234px then proper srcset would be ... 100w ... 200w ... 400w ... 800w ... 1200w ... 1234w (drops 1600 and 2000), but that information is not awailable in the current Image props, so I'm proposing ... 100w ... 200w ... 400w ... 800w ... 1200w ... 1600w ... 2000w ... 9999w which I think is the best you can do in the current circumstances. The main point is that browser will basically ignroe the src set that doesn't have that last ...w directive, and the result is that you are sending tons of html with all those srcsets just for browser to ignore it :)

@JLarky JLarky requested review from samijaber and a team as code owners July 26, 2024 20:30
Copy link

changeset-bot bot commented Jul 26, 2024

⚠️ No Changeset found

Latest commit: 82473d4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@JLarky
Copy link
Contributor Author

JLarky commented Jul 31, 2024

great point! thank you so much for your suggestion

@samijaber
Copy link
Contributor

@JLarky thanks for making the changes! unfortunately it looks like a few of our integration tests are now getting errors specifically around the expected image width.

It's inconsistent: looks like only client-side rendered tests are failing, not SSR'd content.

Feel free to dig into it and try to get to the bottom of the issue. If not, we will need to find the time to investigate your PR further as soon as we have the bandwidth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants