Skip to content

Commit b1110fa

Browse files
benjaminsehlcartogram
authored andcommitted
Remove missing sizes warning if fixed width
1 parent c0cfbe0 commit b1110fa

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

packages/hydrogen-react/src/Image.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,6 @@ export function Image({
135135
);
136136
}
137137

138-
if (!sizes) {
139-
console.warn(
140-
'No sizes prop provided to Image component, ' +
141-
'you may be loading unnecessarily large images. ' +
142-
`Image used is ${src || data?.url}`,
143-
);
144-
}
145-
146138
/* Only use data width if height is also set */
147139

148140
const dataWidth: number | undefined =
@@ -201,6 +193,14 @@ export function Image({
201193
incrementSize,
202194
);
203195

196+
if (!sizes && !isFixedWidth(normalizedWidth)) {
197+
console.warn(
198+
'No sizes prop provided to Image component, ' +
199+
'you may be loading unnecessarily large images. ' +
200+
`Image used is ${src || data?.url}`,
201+
);
202+
}
203+
204204
/*
205205
* We check to see whether the image is fixed width or not,
206206
* if fixed, we still provide a srcSet, but only to account for

0 commit comments

Comments
 (0)