Skip to content

Commit 32e17ef

Browse files
author
polarathene
committed
chore(gatsby-image): Add note about why !! is used
As explained at: gatsbyjs#13287 (comment)
1 parent 6218db9 commit 32e17ef

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

packages/gatsby-image/src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ class Image extends React.Component {
256256
this.setState({ isVisible: true }, () =>
257257
this.setState({
258258
imgLoaded: imageInCache,
259+
// `currentSrc` should be a string, but can be `undefined` in IE,
260+
// !! operator validates the value is not undefined/null/""
259261
imgCached: !!this.imageRef.current.currentSrc,
260262
})
261263
)

0 commit comments

Comments
 (0)