Skip to content

Commit

Permalink
Remove hydrate option from createRoot (#22878)
Browse files Browse the repository at this point in the history
* remove hydrate: true option

* remove missed comment

* lint

* warning

* circumvent flow
  • Loading branch information
salazarm authored Dec 7, 2021
1 parent c7917fe commit 5041c37
Show file tree
Hide file tree
Showing 12 changed files with 149 additions and 251 deletions.
5 changes: 2 additions & 3 deletions fixtures/ssr/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import {createRoot} from 'react-dom';
import {hydrateRoot} from 'react-dom';

import App from './components/App';

let root = createRoot(document, {hydrate: true});
root.render(<App assets={window.assetManifest} />);
let root = hydrateRoot(document, <App assets={window.assetManifest} />);
15 changes: 5 additions & 10 deletions packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,7 @@ describe('ReactDOMFizzServer', () => {
expect(loggedErrors).toEqual([]);

// Attempt to hydrate the content.
const root = ReactDOM.createRoot(container, {hydrate: true});
root.render(<App isClient={true} />);
ReactDOM.hydrateRoot(container, <App isClient={true} />);
Scheduler.unstable_flushAll();

// We're still loading because we're waiting for the server to stream more content.
Expand Down Expand Up @@ -629,8 +628,7 @@ describe('ReactDOMFizzServer', () => {
expect(loggedErrors).toEqual([]);

// Attempt to hydrate the content.
const root = ReactDOM.createRoot(container, {hydrate: true});
root.render(<App />);
ReactDOM.hydrateRoot(container, <App />);
Scheduler.unstable_flushAll();

// We're still loading because we're waiting for the server to stream more content.
Expand Down Expand Up @@ -701,8 +699,7 @@ describe('ReactDOMFizzServer', () => {
pipe(writable);
});

const root = ReactDOM.createRoot(container, {hydrate: true});
root.render(<App showMore={false} />);
const root = ReactDOM.hydrateRoot(container, <App showMore={false} />);
Scheduler.unstable_flushAll();

// We're not hydrated yet.
Expand Down Expand Up @@ -769,8 +766,7 @@ describe('ReactDOMFizzServer', () => {
// We're still showing a fallback.

// Attempt to hydrate the content.
const root = ReactDOM.createRoot(container, {hydrate: true});
root.render(<App />);
ReactDOM.hydrateRoot(container, <App />);
Scheduler.unstable_flushAll();

// We're still loading because we're waiting for the server to stream more content.
Expand Down Expand Up @@ -1459,8 +1455,7 @@ describe('ReactDOMFizzServer', () => {
// We're still showing a fallback.

// Attempt to hydrate the content.
const root = ReactDOM.createRoot(container, {hydrate: true});
root.render(<App isClient={true} />);
ReactDOM.hydrateRoot(container, <App isClient={true} />);
Scheduler.unstable_flushAll();

// We're still loading because we're waiting for the server to stream more content.
Expand Down
Loading

0 comments on commit 5041c37

Please sign in to comment.