Skip to content

Commit 15e4c45

Browse files
committed
rename renderIntoDocument as renderDocument
1 parent 3ec1561 commit 15e4c45

17 files changed

+49
-51
lines changed

packages/react-dom-bindings/src/server/ReactDOMServerFormatConfig.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,11 +1686,11 @@ function pushStartHtml(
16861686
responseState.requiresEmbedding &&
16871687
hasOwnProperty.call(props, 'dangerouslySetInnerHTML')
16881688
) {
1689-
// We only enforce this restriction with new APIs like `renderIntoDocument` which
1689+
// We only enforce this restriction with new APIs like `renderDocument` which
16901690
// we currently feature detect with `requiresEmbedding`.
16911691
// @TODO In a major version lets enforce this restriction globally
16921692
throw new Error(
1693-
'An <html> tag was rendered with a `dangerouslySetInnerHTML` prop while using `renderIntoDocument`. React does not support this; use a `children` prop instead',
1693+
'An <html> tag was rendered with a `dangerouslySetInnerHTML` prop while using `renderDocument`. React does not support this; use a `children` prop instead',
16941694
);
16951695
}
16961696

@@ -1771,7 +1771,7 @@ function pushStartHtml(
17711771
if (differentProps) {
17721772
console.error(
17731773
'React encountered differing props when rendering the root <html> element of' +
1774-
' the fallback children when using `renderIntoDocument`. When using `renderIntoDocument`' +
1774+
' the fallback children when using `renderDocument`. When using `renderDocument`' +
17751775
' React will often emit the <html> tag early, before the we know whether the' +
17761776
' Shell has finished. If the Shell errors and the fallback children are rendered' +
17771777
' the props used on the <html> tag of the fallback tree will be ignored.' +
@@ -1814,11 +1814,11 @@ function pushStartHead(
18141814
responseState.requiresEmbedding &&
18151815
hasOwnProperty.call(props, 'dangerouslySetInnerHTML')
18161816
) {
1817-
// We only enforce this restriction with new APIs like `renderIntoDocument` which
1817+
// We only enforce this restriction with new APIs like `renderDocument` which
18181818
// we currently feature detect with `requiresEmbedding`.
18191819
// @TODO In a major version lets enforce this restriction globally
18201820
throw new Error(
1821-
'A <head> tag was rendered with a `dangerouslySetInnerHTML` prop while using `renderIntoDocument`. React does not support this; use a `children` prop instead',
1821+
'A <head> tag was rendered with a `dangerouslySetInnerHTML` prop while using `renderDocument`. React does not support this; use a `children` prop instead',
18221822
);
18231823
}
18241824

@@ -1877,9 +1877,9 @@ function pushStartHead(
18771877

18781878
if (__DEV__) {
18791879
if (responseState.requiresEmbedding && attributePropsIncluded) {
1880-
// We use this requiresEmbedding flag a heuristic for whether we are rendering with renderIntoDocument
1880+
// We use this requiresEmbedding flag a heuristic for whether we are rendering with renderDocument
18811881
console.error(
1882-
'A <head> tag was rendered with props when using `renderIntoDocument`. In this rendering mode' +
1882+
'A <head> tag was rendered with props when using `renderDocument`. In this rendering mode' +
18831883
' React may emit the head tag early in some circumstances and therefore props on the <head> tag are not' +
18841884
' supported and may be missing in the rendered output for any particular render. In many cases props that' +
18851885
' are set on a <head> tag can be set on the <html> tag instead.',
@@ -2415,7 +2415,7 @@ export function pushEndInstance(
24152415
target.push(endTag1, stringToChunk(type), endTag2);
24162416
}
24172417

2418-
// In some render modes (such as `renderIntoDocument`) WriteEarlyPreamble
2418+
// In some render modes (such as `renderDocument`) WriteEarlyPreamble
24192419
// is called to allow flushing of the preamble and Resources as early as possible.
24202420
// It is possible for this to be called more than once and needs to be
24212421
// resilient to that. For instance by not writing the preamble open tags
@@ -2427,7 +2427,7 @@ export function writeEarlyPreamble(
24272427
willEmitInstructions: boolean,
24282428
): boolean {
24292429
if (enableFloat) {
2430-
// We use `requiresEmbedding` as a hueristic for `renderIntoDocument`
2430+
// We use `requiresEmbedding` as a hueristic for `renderDocument`
24312431
// which is the only render method which should emit an early preamble
24322432
// In the future other render methods might and this hueristic may need
24332433
// to change
@@ -2476,7 +2476,7 @@ export function writeEarlyPreamble(
24762476
// and will close the preamble if necessary. After this function completes
24772477
// the shell will flush. In modes that do not have a shell such as `renderIntoContainer`
24782478
// this function is not called. In modes that render a shell fallback such as
2479-
// `renderIntoDocument` this function is still only called once, either for the
2479+
// `renderDocument` this function is still only called once, either for the
24802480
// primary shell (no fallback possible at this point) or for the fallback shell
24812481
// (was not called for the primary children).
24822482
export function writePreamble(

packages/react-dom/server.browser.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export function renderIntoContainer() {
5050
);
5151
}
5252

53-
export function renderIntoDocument() {
54-
return require('./src/server/ReactDOMFizzServerBrowser').renderIntoDocument.apply(
53+
export function renderDocument() {
54+
return require('./src/server/ReactDOMFizzServerBrowser').renderDocument.apply(
5555
this,
5656
arguments,
5757
);

packages/react-dom/server.bun.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ export function renderIntoContainer() {
5353
);
5454
}
5555

56-
export function renderIntoDocument() {
57-
return require('./src/server/ReactDOMFizzServerBun').renderIntoDocument.apply(
56+
export function renderDocument() {
57+
return require('./src/server/ReactDOMFizzServerBun').renderDocument.apply(
5858
this,
5959
arguments,
6060
);

packages/react-dom/server.node.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export function renderIntoContainerAsPipeableStream() {
5050
);
5151
}
5252

53-
export function renderIntoDocumentAsPipeableStream() {
54-
return require('./src/server/ReactDOMFizzServerNode').renderIntoDocumentAsPipeableStream.apply(
53+
export function renderDocumentAsPipeableStream() {
54+
return require('./src/server/ReactDOMFizzServerNode').renderDocumentAsPipeableStream.apply(
5555
this,
5656
arguments,
5757
);

packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -432,9 +432,9 @@ describe('ReactDOMFizzServer', () => {
432432
mergeOptions(options, renderOptions),
433433
);
434434
}
435-
function renderIntoDocumentAsPipeableStream(jsx, fallback, options) {
435+
function renderDocumentAsPipeableStream(jsx, fallback, options) {
436436
// Merge options with renderOptions, which may contain featureFlag specific behavior
437-
return ReactDOMFizzServer.renderIntoDocumentAsPipeableStream(
437+
return ReactDOMFizzServer.renderDocumentAsPipeableStream(
438438
jsx,
439439
fallback,
440440
mergeOptions(options, renderOptions),
@@ -6165,15 +6165,13 @@ describe('ReactDOMFizzServer', () => {
61656165
});
61666166
});
61676167

6168-
describe('renderIntoDocument', () => {
6168+
describe('renderDocument', () => {
61696169
// @gate enableFloat && enableFizzIntoDocument
61706170
it('can render arbitrary HTML into a Document', async () => {
61716171
let content = '';
61726172
writable.on('data', chunk => (content += chunk));
61736173
await act(() => {
6174-
const {pipe} = renderIntoDocumentAsPipeableStream(
6175-
<div id="div">foo</div>,
6176-
);
6174+
const {pipe} = renderDocumentAsPipeableStream(<div id="div">foo</div>);
61776175
pipe(writable);
61786176
});
61796177

@@ -6196,7 +6194,7 @@ describe('ReactDOMFizzServer', () => {
61966194
let content = '';
61976195
writable.on('data', chunk => (content += chunk));
61986196
await act(() => {
6199-
const {pipe} = renderIntoDocumentAsPipeableStream(
6197+
const {pipe} = renderDocumentAsPipeableStream(
62006198
<body id="body">foo</body>,
62016199
);
62026200
pipe(writable);
@@ -6220,7 +6218,7 @@ describe('ReactDOMFizzServer', () => {
62206218
writable.on('data', chunk => (content += chunk));
62216219
await expect(async () => {
62226220
await act(() => {
6223-
const {pipe} = renderIntoDocumentAsPipeableStream(
6221+
const {pipe} = renderDocumentAsPipeableStream(
62246222
<html id="html">
62256223
<head id="head">
62266224
<title>a title</title>
@@ -6231,7 +6229,7 @@ describe('ReactDOMFizzServer', () => {
62316229
pipe(writable);
62326230
});
62336231
}).toErrorDev(
6234-
'A <head> tag was rendered with props when using `renderIntoDocument`. In this rendering mode React may emit the head tag early in some circumstances and therefore props on the <head> tag are not supported and may be missing in the rendered output for any particular render. In many cases props that are set on a <head> tag can be set on the <html> tag instead.',
6232+
'A <head> tag was rendered with props when using `renderDocument`. In this rendering mode React may emit the head tag early in some circumstances and therefore props on the <head> tag are not supported and may be missing in the rendered output for any particular render. In many cases props that are set on a <head> tag can be set on the <html> tag instead.',
62356233
);
62366234

62376235
expect(content.slice(0, 47)).toEqual(
@@ -6253,7 +6251,7 @@ describe('ReactDOMFizzServer', () => {
62536251
let content = '';
62546252
writable.on('data', chunk => (content += chunk));
62556253
await act(() => {
6256-
const {pipe} = renderIntoDocumentAsPipeableStream(
6254+
const {pipe} = renderDocumentAsPipeableStream(
62576255
<html id="html">
62586256
<body id="body">foo</body>
62596257
</html>,
@@ -6284,7 +6282,7 @@ describe('ReactDOMFizzServer', () => {
62846282

62856283
const errors = [];
62866284
await act(() => {
6287-
const {pipe} = renderIntoDocumentAsPipeableStream(
6285+
const {pipe} = renderDocumentAsPipeableStream(
62886286
<html id="html">
62896287
<body id="body">
62906288
<Throw />
@@ -6332,7 +6330,7 @@ describe('ReactDOMFizzServer', () => {
63326330

63336331
const errors = [];
63346332
await act(() => {
6335-
const {pipe} = renderIntoDocumentAsPipeableStream(
6333+
const {pipe} = renderDocumentAsPipeableStream(
63366334
<html id="html">
63376335
<BlockOn value="foo">
63386336
<body id="body">
@@ -6406,7 +6404,7 @@ describe('ReactDOMFizzServer', () => {
64066404

64076405
const errors = [];
64086406
await act(() => {
6409-
const {pipe} = renderIntoDocumentAsPipeableStream(
6407+
const {pipe} = renderDocumentAsPipeableStream(
64106408
<html id="html">
64116409
<link rel="stylesheet" href="foo" precedence="foo" />
64126410
<link rel="stylesheet" href="bar" precedence="bar" />
@@ -6459,7 +6457,7 @@ describe('ReactDOMFizzServer', () => {
64596457

64606458
const errors = [];
64616459
await act(() => {
6462-
const {pipe} = renderIntoDocumentAsPipeableStream(
6460+
const {pipe} = renderDocumentAsPipeableStream(
64636461
<html id="html">
64646462
<body id="body">
64656463
hello world
@@ -6505,7 +6503,7 @@ describe('ReactDOMFizzServer', () => {
65056503

65066504
const errors = [];
65076505
await act(() => {
6508-
const {pipe} = renderIntoDocumentAsPipeableStream(
6506+
const {pipe} = renderDocumentAsPipeableStream(
65096507
<html id="html">
65106508
<body id="body">
65116509
<Throw />
@@ -6550,7 +6548,7 @@ describe('ReactDOMFizzServer', () => {
65506548

65516549
const errors = [];
65526550
await act(() => {
6553-
const {pipe} = renderIntoDocumentAsPipeableStream(
6551+
const {pipe} = renderDocumentAsPipeableStream(
65546552
<html id="html">
65556553
<body id="body">
65566554
<BlockOn value="error">
@@ -6637,7 +6635,7 @@ describe('ReactDOMFizzServer', () => {
66376635
}
66386636

66396637
await act(() => {
6640-
const {pipe} = renderIntoDocumentAsPipeableStream(
6638+
const {pipe} = renderDocumentAsPipeableStream(
66416639
<html id="html">
66426640
<head />
66436641
<body id="body">
@@ -6745,7 +6743,7 @@ describe('ReactDOMFizzServer', () => {
67456743
const errors = [];
67466744
try {
67476745
await act(() => {
6748-
const {pipe} = renderIntoDocumentAsPipeableStream(
6746+
const {pipe} = renderDocumentAsPipeableStream(
67496747
<html id="html">
67506748
<head />
67516749
<link rel="stylesheet" href="foo" precedence="foo" />

packages/react-dom/src/__tests__/ReactDOMFizzServerBrowser-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,12 +646,12 @@ describe('ReactDOMFizzServerBrowser', () => {
646646
});
647647
});
648648

649-
describe('renderIntoDocument', () => {
649+
describe('renderDocument', () => {
650650
// @gate enableFloat && enableFizzIntoDocument
651651
it('can render into a container', async () => {
652652
let content = '';
653653
await act(async () => {
654-
const stream = ReactDOMFizzServer.renderIntoDocument(<div>foo</div>);
654+
const stream = ReactDOMFizzServer.renderDocument(<div>foo</div>);
655655
const reader = stream.getReader();
656656
while (true) {
657657
const {done, value} = await reader.read();

packages/react-dom/src/__tests__/ReactDOMFizzServerNode-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,11 +649,11 @@ describe('ReactDOMFizzServerNode', () => {
649649
});
650650
});
651651

652-
describe('renderIntoDocumentAsPipeableStream', () => {
652+
describe('renderDocumentAsPipeableStream', () => {
653653
// @gate enableFloat && enableFizzIntoDocument
654654
it('can render into a container', async () => {
655655
const {writable, output} = getTestWritable();
656-
const {pipe} = ReactDOMFizzServer.renderIntoDocumentAsPipeableStream(
656+
const {pipe} = ReactDOMFizzServer.renderDocumentAsPipeableStream(
657657
<div>foo</div>,
658658
);
659659
pipe(writable);

packages/react-dom/src/server/ReactDOMFizzServerBrowser.fb.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
export {
1111
renderIntoContainer,
12-
renderIntoDocument,
12+
renderDocument,
1313
renderToReadableStream,
1414
version,
1515
} from './ReactDOMFizzServerBrowserImpl';

packages/react-dom/src/server/ReactDOMFizzServerBrowser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
export {
1111
renderIntoContainer,
12-
renderIntoDocument,
12+
renderDocument,
1313
renderToReadableStream,
1414
version,
1515
} from './ReactDOMFizzServerBrowserImpl';

packages/react-dom/src/server/ReactDOMFizzServerBrowserImpl.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ type IntoDocumentOptions = {
220220
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
221221
};
222222

223-
function renderIntoDocument(
223+
function renderDocument(
224224
children: ReactNodeList,
225225
fallback?: ReactNodeList,
226226
options?: IntoDocumentOptions,
@@ -290,6 +290,6 @@ function renderIntoDocument(
290290
export {
291291
renderToReadableStream,
292292
renderIntoContainer,
293-
renderIntoDocument,
293+
renderDocument,
294294
ReactVersion as version,
295295
};

0 commit comments

Comments
 (0)