Skip to content

Commit

Permalink
Hydrate when the page was server rendered (#29016) (#29053)
Browse files Browse the repository at this point in the history
(cherry picked from commit bf6f264)

Co-authored-by: Kyle Mathews <[email protected]>
  • Loading branch information
GatsbyJS Bot and KyleAMathews authored Jan 16, 2021
1 parent bd5c63c commit 47324d0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/gatsby/cache-dir/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,11 @@ apiRunnerAsync(`onClientEntry`).then(() => {
const renderer = apiRunner(
`replaceHydrateFunction`,
undefined,
// TODO replace with hydrate once dev SSR is ready
// but only for SSRed pages.
ReactDOM.render
// Client only pages have any empty body so we just do a normal
// render to avoid React complaining about hydration mis-matches.
document.getElementById(`___gatsby`).children.length === 0
? ReactDOM.render
: ReactDOM.hydrate
)[0]

let dismissLoadingIndicator
Expand Down

0 comments on commit 47324d0

Please sign in to comment.