Skip to content

Commit

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

Co-authored-by: Ward Peeters <[email protected]>
  • Loading branch information
GatsbyJS Bot and wardpeet authored Oct 29, 2021
1 parent 5505c47 commit 3e8fe2f
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 3e8fe2f

Please sign in to comment.