Skip to content

Commit 588f1c1

Browse files
committed
Remove in/delete
1 parent 0969142 commit 588f1c1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

packages/gatsby-plugin-image/src/components/gatsby-image.browser.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ export const GatsbyImageHydrator: FunctionComponent<GatsbyImageProps> = function
5757
as: Type = `div`,
5858
style,
5959
className,
60+
class: preactClass,
6061
onStartLoad,
6162
image,
6263
onLoad: customOnLoad,
@@ -69,9 +70,8 @@ export const GatsbyImageHydrator: FunctionComponent<GatsbyImageProps> = function
6970
}
7071
return null
7172
}
72-
if (`class` in props) {
73-
className = props.class
74-
delete props.class
73+
if (preactClass) {
74+
className = preactClass
7575
}
7676
const { width, height, layout, images } = image
7777

packages/gatsby-plugin-image/src/components/gatsby-image.server.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const GatsbyImageHydrator: FunctionComponent<{
1818
export const GatsbyImage: FunctionComponent<GatsbyImageProps> = function GatsbyImage({
1919
as,
2020
className,
21+
class: preactClass,
2122
style,
2223
image,
2324
loading = `lazy`,
@@ -32,9 +33,8 @@ export const GatsbyImage: FunctionComponent<GatsbyImageProps> = function GatsbyI
3233
console.warn(`[gatsby-plugin-image] Missing image prop`)
3334
return null
3435
}
35-
if (`class` in props) {
36-
className = props.class
37-
delete props.class
36+
if (preactClass) {
37+
className = preactClass
3838
}
3939
imgStyle = {
4040
objectFit,

0 commit comments

Comments
 (0)