Skip to content

Commit bf6f264

Browse files
authored
Hydrate when the page was server rendered (#29016)
1 parent e72533d commit bf6f264

File tree

1 file changed

+5
-3
lines changed
  • packages/gatsby/cache-dir

1 file changed

+5
-3
lines changed

packages/gatsby/cache-dir/app.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,11 @@ apiRunnerAsync(`onClientEntry`).then(() => {
119119
const renderer = apiRunner(
120120
`replaceHydrateFunction`,
121121
undefined,
122-
// TODO replace with hydrate once dev SSR is ready
123-
// but only for SSRed pages.
124-
ReactDOM.render
122+
// Client only pages have any empty body so we just do a normal
123+
// render to avoid React complaining about hydration mis-matches.
124+
document.getElementById(`___gatsby`).children.length === 0
125+
? ReactDOM.render
126+
: ReactDOM.hydrate
125127
)[0]
126128

127129
let dismissLoadingIndicator

0 commit comments

Comments
 (0)