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-plugin-image] Placeholder fails to be removed on Safari (MacOS + iOS) when using multiples of the same source image.

See original GitHub issue

Description

Both StaticImage or GatsbyImage fail to replace the placeholder properly on Safari during the following scenario:

  1. There are multiple image components using the same source.
  2. Some of these images are initially outside of the viewport, necessitating the lazy-loading behaviour.
  3. User is using Safari 14 (MacOS) or Safari (iOS 14.5/14.6).
  4. Behaviour is exhibited in built environment, but not development environment.

Steps to reproduce

  1. Clone / view minimal repo using gatsby-starter-default from here.

  2. yarn build && yarn serve, or see my hosted minimal reproduction on Gatsby Cloud here.

  3. Load Safari and scroll down the viewport to load additional StaticImage components that reference the same source file.

  4. After a few images, only the placeholders load. It’s at image 5 and beyond for me.

Expected result

Multiple StaticImage or GatsbyImage component references to the same source image should render fine, replacing placeholders with the correct image after coming into view.

The expected behaviour can be seen on both Chrome and Firefox.

Actual result

Per steps to reproduce, some images out of the viewport are not replacing their placeholders with the source image.

Environment

System: OS: Linux 4.15 Ubuntu 18.04.2 LTS (Bionic Beaver) CPU: (4) x64 Intel® Xeon® Gold 6140 CPU @ 2.30GHz Shell: 5.4.2 - /usr/bin/zsh Binaries: Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node Yarn: 1.22.5 - /usr/bin/yarn npm: 6.14.13 - ~/.nvm/versions/node/v14.17.0/bin/npm Languages: Python: 2.7.17 - /usr/bin/python npmPackages: gatsby: ^3.4.1 => 3.4.1 gatsby-plugin-gatsby-cloud: ^2.4.1 => 2.4.1 gatsby-plugin-image: ^1.4.0 => 1.4.0 gatsby-plugin-manifest: ^3.4.0 => 3.4.0 gatsby-plugin-offline: ^4.4.0 => 4.4.0 gatsby-plugin-react-helmet: ^4.4.0 => 4.4.0 gatsby-plugin-sharp: ^3.4.1 => 3.4.1 gatsby-source-filesystem: ^3.4.0 => 3.4.0 gatsby-transformer-sharp: ^3.4.0 => 3.4.0

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:12
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ascorbiccommented, Sep 18, 2021

Hi @sidartha. I don’t work at Gatsby anymore. I do remember fixing another simialr bug related to Safari’s lack of lazy loading. My guess is that it’s related to the way it records whether a file has previously loaded, which is keyed by URL (iirc). @wardpeet wrote a lot of that code, so may have a better idea.

0reactions
slocinskidevcommented, Apr 8, 2022

Problem is still not solved, in my case creating a separate query didn’t work, but creating a separate query + changing the quality of the image helped at least one

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gatsby Image placeholder not being replaced on Safari iOS
Only images that are using img seem to work, the ones with gatsby-image seem to stuck on the gray svg placeholder state and...
Read more >
Gatsby Image plugin
This guide will show you how to configure your images, including choosing layouts, placeholders and image processing options. While most of these options ......
Read more >
Failed to set plugin placeholders … | Apple Developer Forums
I've done extensive searches for this error with no sucess. ... The extension has to have the same identifier as the original app...
Read more >
Gatsby Images and Safari - DEV Community 👩‍💻👨‍💻
This attribute causes images on the page wait to load until they are in view. When used in conjunction with Low Quality Image...
Read more >
Re-open a thread - Community Water Cooler - Prismic People
Import then downgrade? Dynamic queries with gatsby-source-prismic. Safari v12 and under CORS error. Private media documents.
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