question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

gatsby-image loading="eager" does not work, only critical={true} works

See original GitHub issue

Description

I’m trying to enable eager loading on images using gatsby-image.

Steps to reproduce

  1. npm i --save gatsby-image@latest
  2. Import image from gatsby graphql w/ webp
  3. Place below the fold and turn off chrome cache, and scroll down to image:
<Image loading="eager" />
<Image criticial />

Expected result

Critical and loading=“eager” behaves the same way

Actual result

Critical loads the image on DOM entry, loading=“eager” behaves like loading=“lazy”

Other info

It looks like the gatsby-image source still references the props.critical instead of checking props.loading.

https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-image/src/index.js#L216

Oddly there is a warning that gets thrown here to switch to the new loading prop vs eager:

https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-image/src/index.js#L36

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
KancerEzeroglucommented, Aug 5, 2019

If someone doesn’t work on this issue, I can take it 😃 Can I?

5reactions
doodybrainscommented, Jul 23, 2019

This is also happening for me. Are there any work arounds?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gatsby Image
Speedy, optimized images without the work. gatsby-image is a React component specially designed to work seamlessly with Gatsby's GraphQL queries.
Read more >
Gatsby Plugin Image - Eager loading not functioning with ...
I am attempting to build an image slider using Gatsby JS (SSG) and framer motion. I am running into an issue where images...
Read more >
Optimising gatsby-image Even Further, by John Kavanagh
Gatsby -image delivers highly-optimised images using some very clever, advanced loading techniques. There are a few tricks to speed it up yet further...
Read more >
Gatsby Changelog | 5.3.0
Install gatsby@next and let us know if you have any issues. ... vse-volod: chore(docs): Update "Working with Images in Markdown" PR #34621 ...
Read more >
Gatsby Static Image (gatsby-plugin-image) // Speed Up Your ...
Supercharge your Gatsby projects with this no -graphQL plugin to supercharge your static images. I'll walk you through how to install and use ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found