Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Changed

- Added fetchPriority and removed `data-vtex-preload` attribute in the `ProductImage` component.

## [3.178.4] - 2025-09-30

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ const ProductImage: FC<Props> = ({
>
<img
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Avoid setting a low fetch priority when loading="lazy" is used; browsers treat lazy images as low priority automatically, and explicitly forcing low can harm above-the-fold cases when index logic changes. Only set fetchPriority="high" for the first image and omit it otherwise to prevent unintended network prioritization issues. [general, importance: 6]

ref={imageRef}
data-vtex-preload={index === 0 ? 'true' : 'false'}
Comment thread
iago1501 marked this conversation as resolved.
className={`${applyModifiers(handles.productImageTag, 'main')}`}
style={{
width: '100%',
Expand All @@ -107,6 +106,7 @@ const ProductImage: FC<Props> = ({
alt={alt}
title={alt}
loading={index === 0 ? 'eager' : 'lazy'}
{...(index === 0 && { fetchPriority: 'high' })}
// WIP
// The value of the "sizes" attribute means: if the window has at most 64.1rem of width,
// the image will be of a width of 100vw. Otherwise, the
Expand Down
1 change: 1 addition & 0 deletions react/typings/jsx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ import 'react'
declare module 'react' {
interface ImgHTMLAttributes<T> extends HTMLAttributes<T> {
loading?: 'lazy' | 'eager' | 'auto'
fetchPriority?: 'high' | 'low' | 'auto'
}
}
Loading