next/image priority with media queries #29621
Replies: 9 comments 2 replies
-
|
I've got here through a few discussions and issues that have been posted. Although i agree the quick solution is to have multiple Image components set with media queries i don't believe that this is the long term solution. The image component should be improved to accept attributes for mobile, tablet, desktop and however many is required for the use case of the client. and the component could be called to mimic what we are replacing initially. this way and if possible the component can read the client to see what size is required to be served, set priority to the image size required and thus allow a more performant solution to be served. |
Beta Was this translation helpful? Give feedback.
-
|
I see your point @richyrb00. My HTML-markup requires me to use two separate img-tags. It would not be possible with a single tag and multiple attributes. What are your thoughts? |
Beta Was this translation helpful? Give feedback.
-
|
Im also having this issue loading my header image which is different in mobile and web, when i set priority on the images it preloads both images for web and mobile hindering performance.. a priority media query would be great! |
Beta Was this translation helpful? Give feedback.
-
|
Any word on this? 👀 |
Beta Was this translation helpful? Give feedback.
-
|
Any progress on this ?? |
Beta Was this translation helpful? Give feedback.
-
|
This is still very much wanted by me 🌟 |
Beta Was this translation helpful? Give feedback.
-
|
Linking a similar discussion - #43756 Would be nice to have the const preloadImgProps = getImgProps(imageProps);
ReactDOM.preload(preloadImgProps.props.src, {
as: "image",
imageSrcSet: preloadImgProps.props.srcSet,
+ media: "(min-width: 640px)",
fetchPriority: "high",
}); |
Beta Was this translation helpful? Give feedback.
-
|
Have you tried using a isMobile() hook and then |
Beta Was this translation helpful? Give feedback.
-
|
I also agree that having a responsive priority prop would be very useful. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the feature you'd like to request
When specifying the
priorityprop to theImagecomponent innext/image, it would be useful to specify a media query, to support desktop-only images, for example.Describe the solution you'd like
Perhaps a
priorityMediaQueryprop that can be set to a specific media query?Describe alternatives you've considered
I've used a wrapper div with
display:nonefor some media query but thepriorityprop overrides this.Beta Was this translation helpful? Give feedback.
All reactions