gatsby-image loading="eager" does not work, only critical={true} works
See original GitHub issueDescription
I’m trying to enable eager loading on images using gatsby-image.
Steps to reproduce
- npm i --save gatsby-image@latest
- Import image from gatsby graphql w/ webp
- 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:
- Created 4 years ago
- Reactions:8
- Comments:8 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
If someone doesn’t work on this issue, I can take it 😃 Can I?
This is also happening for me. Are there any work arounds?