Skip to content

Commit

Permalink
fix(gatsby-plugin-image): Check for render container (#30898)
Browse files Browse the repository at this point in the history
  • Loading branch information
ascorbic committed Apr 16, 2021
1 parent 2e200f8 commit 9ee366e
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 @@ -83,10 +83,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 9ee366e

Please sign in to comment.