Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby-plugin-image): don't show hydration warning (#28407) #28512

Merged
merged 1 commit into from
Dec 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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