Skip to content

Commit

Permalink
fix(gatsby-plugin-image): flickering when state changes (#33732)
Browse files Browse the repository at this point in the history
  • Loading branch information
wardpeet authored Oct 29, 2021
1 parent dbea5f0 commit 0a04e38
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
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 0a04e38

Please sign in to comment.