Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gatsby-plugin-image] Placeholder fails to be removed on Safari (MacOS + iOS) when using multiples of the same source image. #31669

Open
ardiewen opened this issue May 31, 2021 · 7 comments
Labels
status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. topic: media Related to gatsby-plugin-image, or general image/media processing topics type: bug An issue or pull request relating to a bug in Gatsby

Comments

@ardiewen
Copy link

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(R) Xeon(R) 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

@ardiewen ardiewen added the type: bug An issue or pull request relating to a bug in Gatsby label May 31, 2021
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 31, 2021
@LekoArts LekoArts added topic: media Related to gatsby-plugin-image, or general image/media processing topics and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jun 4, 2021
@github-actions github-actions bot added stale? Issue that may be closed soon due to the original author not responding any more. and removed stale? Issue that may be closed soon due to the original author not responding any more. labels Jun 24, 2021
@velser
Copy link

velser commented Jul 10, 2021

Updated to latest.

Issue persists on Safari. Had to make a copy image and two GraphQL separate results as a workaround.

@github-actions github-actions bot added stale? Issue that may be closed soon due to the original author not responding any more. and removed stale? Issue that may be closed soon due to the original author not responding any more. labels Jul 30, 2021
@theAdmiralNelson
Copy link

I'm seeing this issue as well

@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Aug 26, 2021
@ardiewen
Copy link
Author

not stale

@github-actions github-actions bot removed the stale? Issue that may be closed soon due to the original author not responding any more. label Aug 27, 2021
@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Sep 16, 2021
@sidartha
Copy link

I'm seeing this issue too and I believe #33194 is also pointing to this issue.

From some digging, I believe that this is affecting Safari because Safari doesn't have native lazy load support. It seems like that when the image appears multiple times, forceRender is not being set to true here.

As @ardiewen points out above, this doesn't affect the development environment since forceRender is always true here when in development mode.

I'm not sure how one would go about fixing this. @ascorbic, it seems like you've worked on these files recently. Do you have any ideas?

@ascorbic
Copy link
Contributor

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.

@github-actions github-actions bot removed the stale? Issue that may be closed soon due to the original author not responding any more. label Sep 19, 2021
@github-actions github-actions bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Oct 9, 2021
@wardpeet wardpeet added status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. and removed stale? Issue that may be closed soon due to the original author not responding any more. labels Oct 29, 2021
@wardpeet wardpeet self-assigned this Oct 29, 2021
@spencerwhyte
Copy link

We are also seeing this issue, let me know if there is any way that we can help 👍

@gatsbyjs gatsbyjs deleted a comment from github-actions bot Dec 3, 2021
@gatsbyjs gatsbyjs deleted a comment from github-actions bot Dec 3, 2021
@gatsbyjs gatsbyjs deleted a comment from github-actions bot Dec 3, 2021
@gatsbyjs gatsbyjs deleted a comment from ardiewen Dec 3, 2021
@gatsbyjs gatsbyjs deleted a comment from ardiewen Dec 3, 2021
@gatsbyjs gatsbyjs deleted a comment from github-actions bot Dec 3, 2021
@gatsbyjs gatsbyjs deleted a comment from github-actions bot Dec 3, 2021
@slocinskidev
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: confirmed Issue with steps to reproduce the bug that’s been verified by at least one reviewer. topic: media Related to gatsby-plugin-image, or general image/media processing topics type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

9 participants