Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hydrate option from createRoot #22878

Merged
merged 5 commits into from Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions fixtures/ssr/src/index.js
@@ -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
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