Skip to content

Commit

Permalink
fix(gatsby-plugin-image): Check for render container (#30898) (#30943)
Browse files Browse the repository at this point in the history
(cherry picked from commit 9ee366e)

Co-authored-by: Matt Kane <matt@gatsbyjs.com>
  • Loading branch information
GatsbyJS Bot and ascorbic committed Apr 19, 2021
1 parent 2ee989c commit c753d9c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/gatsby-plugin-image/src/components/lazy-hydrate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,12 @@ export function lazyHydrate(
</LayoutWrapper>
)

// Force render to mitigate "Expected server HTML to contain a matching" in develop
const doRender = hydrated.current || forceHydrate.current ? render : hydrate
doRender(component, root.current)
hydrated.current = true
if (root.current) {
// Force render to mitigate "Expected server HTML to contain a matching" in develop
const doRender = hydrated.current || forceHydrate.current ? render : hydrate
doRender(component, root.current)
hydrated.current = true
}

return (): void => {
if (root.current) {
Expand Down

0 comments on commit c753d9c

Please sign in to comment.