Skip to content

Commit

Permalink
fix(gatsby-plugin-image): don't show hydration warning
Browse files Browse the repository at this point in the history
  • Loading branch information
wardpeet committed Dec 1, 2020
1 parent b89b068 commit 681869c
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,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 681869c

Please sign in to comment.