File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
packages/gatsby-image/src Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -283,16 +283,17 @@ class Image extends React.Component {
283283 // already in the browser cache so it's cheap to just show directly.
284284 this . seenBefore = isBrowser && inImageCache ( props )
285285
286- this . addNoScript = ! ( props . critical && ! props . fadeIn )
286+ this . isCritical = props . loading === `eager` || props . critical
287+
288+ this . addNoScript = ! ( this . isCritical && ! props . fadeIn )
287289 this . useIOSupport =
288290 ! hasNativeLazyLoadSupport &&
289291 hasIOSupport &&
290- ! props . critical &&
292+ ! this . isCritical &&
291293 ! this . seenBefore
292294
293295 const isVisible =
294- props . critical ||
295- props . loading == `eager` ||
296+ this . isCritical ||
296297 ( isBrowser && ( hasNativeLazyLoadSupport || ! this . useIOSupport ) )
297298
298299 this . state = {
@@ -311,7 +312,7 @@ class Image extends React.Component {
311312 if ( this . state . isVisible && typeof this . props . onStartLoad === `function` ) {
312313 this . props . onStartLoad ( { wasCached : inImageCache ( this . props ) } )
313314 }
314- if ( this . props . critical ) {
315+ if ( this . isCritical ) {
315316 const img = this . imageRef . current
316317 if ( img && img . complete ) {
317318 this . handleImageLoaded ( )
You can’t perform that action at this time.
0 commit comments