Skip to content

Commit

Permalink
fix(gatsby-plugin-image): flickering when state changes (#33732) (#33807
Browse files Browse the repository at this point in the history
)

(cherry picked from commit 0a04e38)

Co-authored-by: Ward Peeters <ward@coding-tech.com>
  • Loading branch information
GatsbyJS Bot and wardpeet committed Nov 2, 2021
1 parent c0d07e7 commit 880022e
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -90,11 +90,12 @@ class GatsbyImageHydrator extends Component<
}

return import(`./lazy-hydrate`).then(({ lazyHydrate }) => {
const cacheKey = JSON.stringify(this.props.image.images)
this.lazyHydrator = lazyHydrate(
{
image: props.image.images,
isLoading: state.isLoading,
isLoaded: state.isLoaded,
isLoading: state.isLoading || hasImageLoaded(cacheKey),
isLoaded: state.isLoaded || hasImageLoaded(cacheKey),
toggleIsLoaded: () => {
props.onLoad?.()

Expand Down

0 comments on commit 880022e

Please sign in to comment.