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] art directed images flicker when parent component rerenders

See original GitHub issue

Preliminary Checks

Description

When a parent component containing an art directed image re-renders, the art directed image “flickers” even after it has been loaded. This behaviour does not occur with a non-art directed GatsbyImage component.

This behaviour exists in both development and built environments.

Reproduction Link

https://github.com/ardiewen/gatsby-image-withartdirection-repro

Steps to Reproduce

  1. Start a new repo and install gatsby-plugin-image gatsby-plugin-sharp gatsby-transformer-sharp gatsby-source-filesystem or clone this minimal reproduction
  2. yarn && yarn develop to test in development environments with no flags
  3. Click the increment button on each section to see the behaviour
  4. yarn build && yarn start to test in the built environment
  5. Click the increment button on each section to see the behaviour …

Expected Result

Art directed images shouldn’t “flicker” after they’ve been loaded, unless the viewport / media query is changing.

Actual Result

It appears that the GatsbyImage component itself isn’t re-rendering, but the picture element is constantly being unmounted / remounted when the parent component is rerendered.

Environment

System:
    OS: Linux 5.10 Ubuntu 20.04.3 LTS (Focal Fossa)
    CPU: (16) x64 AMD Ryzen 7 5800X 8-Core Processor
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 14.17.5 - ~/.nvm/versions/node/v14.17.5/bin/node
    Yarn: 1.22.15 - /usr/bin/yarn
    npm: 6.14.14 - ~/.nvm/versions/node/v14.17.5/bin/npm
  npmPackages:
    gatsby: ^4.2.0 => 4.2.0 
    gatsby-plugin-image: ^2.2.0 => 2.2.0 
    gatsby-plugin-sharp: ^4.2.0 => 4.2.0 
    gatsby-source-filesystem: ^4.2.0 => 4.2.0 
    gatsby-transformer-sharp: ^4.2.0 => 4.2.0

Config Flags

N/A

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6

github_iconTop GitHub Comments

3reactions
dgozencommented, Dec 21, 2021

I am not sure what you mean by ‘Art directed’ images but we have the same issue I think. We are migrating to gatsby-plugin-images and we have a flicker issue on images. Its a load blocker for migration… You can see the screen recording below from our test branch.

https://user-images.githubusercontent.com/55344620/146938366-293afa9f-faf0-45bb-bd41-23524b53b4e2.mov

.

0reactions
twobytecommented, Jun 9, 2022

OK, thanks for the feedback @dgozen.
I have had to disable the withArtDirection feature for now, so I can progress with the build. Hoping there will be time to return to this and get it working towards the end of the project.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gatsby Image plugin
This guide will show you how to configure your images, including choosing layouts, placeholders and image processing options. While most of…
Read more >
Gatsby Image Chrome flicker on Windows 10 - Stack Overflow
Found it. Although in general the flickering issue with Chrome + Windows is fixed, it seems that there are cases where hardware acceleration ......
Read more >
Gatsby Changelog | 5.3.0
For example, in gatsby-plugin-image you were able to use it with tracedSvg and ... Always hydrate images and use the right parent element,...
Read more >
An Introduction to Gatsby Plugin Image | Rob Marshall
The Old (Original) Gatsby Image Component. Gatsby Image is (was) a clever piece of code that works with the Gatsby GraphQL queries to...
Read more >
oSb - River Thames Conditions - Environment Agency - GOV.UK
Steinzeug dn 150, Soap skin sketchup plugin, Best buy tv black friday, Japanese lanterns ... Northern rivers art gallery ballina, Fredericksburg pa hotels, ......
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