Skip to content

Commit

Permalink
fix(gatsby-plugin-image): don't show hydration warning (#28407)
Browse files Browse the repository at this point in the history
Co-authored-by: Matt Kane <matt@gatsbyjs.com>
Co-authored-by: gatsbybot <mathews.kyle+gatsbybot@gmail.com>
  • Loading branch information
3 people committed Dec 3, 2020
1 parent daeb624 commit b6b5207
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,15 @@ export const GatsbyImageHydrator: FunctionComponent<GatsbyImageProps> = function
const hasSSRHtml = root.current.querySelector(`[data-gatsby-image-ssr]`)
// On first server hydration do nothing
if (hasNativeLazyLoadSupport() && hasSSRHtml && !hydrated.current) {
hydrated.current = true
return
}

// When no ssrHtml is found (develop) we should force render instead of hydrate
if (!hasSSRHtml) {
hydrated.current = true
}

import(`./lazy-hydrate`).then(({ lazyHydrate }) => {
lazyHydrator.current = lazyHydrate(
{
Expand Down

0 comments on commit b6b5207

Please sign in to comment.