mirror of
https://github.com/facebook/react.git
synced 2026-11-18 20:15:56 +00:00
Clean up enablePostpone Experiment (#35048)
We're not shipping this and it's a lot of code to maintain that is blocking my refactor of Fizz for SuspenseList.
This commit is contained in:
1 parent
c308cb5905
commit
dd048c3b2d
47 files changed
+146
-4045
No files matched your search
-105
@@ -39,12 +39,9 @@ import type {
|
||||
EncodeFormActionCallback,
|
||||
} from './ReactFlightReplyClient';
|
||||
|
||||
import type {Postpone} from 'react/src/ReactPostpone';
|
||||
|
||||
import type {TemporaryReferenceSet} from './ReactFlightTemporaryReferences';
|
||||
|
||||
import {
|
||||
enablePostpone,
|
||||
enableProfilerTimer,
|
||||
enableComponentPerformanceTrack,
|
||||
enableAsyncDebugInfo,
|
||||
@@ -89,7 +86,6 @@ import {
|
||||
import {
|
||||
REACT_LAZY_TYPE,
|
||||
REACT_ELEMENT_TYPE,
|
||||
REACT_POSTPONE_TYPE,
|
||||
ASYNC_ITERATOR,
|
||||
REACT_FRAGMENT_TYPE,
|
||||
} from 'shared/ReactSymbols';
|
||||
@@ -3460,88 +3456,6 @@ function resolveErrorDev(
|
||||
return error;
|
||||
}
|
||||
|
||||
function resolvePostponeProd(
|
||||
response: Response,
|
||||
id: number,
|
||||
streamState: StreamState,
|
||||
): void {
|
||||
if (__DEV__) {
|
||||
// These errors should never make it into a build so we don't need to encode them in codes.json
|
||||
// eslint-disable-next-line react-internal/prod-error-codes
|
||||
throw new Error(
|
||||
'resolvePostponeProd should never be called in development mode. Use resolvePostponeDev instead. This is a bug in React.',
|
||||
);
|
||||
}
|
||||
const error = new Error(
|
||||
'A Server Component was postponed. The reason is omitted in production' +
|
||||
' builds to avoid leaking sensitive details.',
|
||||
);
|
||||
const postponeInstance: Postpone = (error: any);
|
||||
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
|
||||
postponeInstance.stack = 'Error: ' + error.message;
|
||||
const chunks = response._chunks;
|
||||
const chunk = chunks.get(id);
|
||||
if (!chunk) {
|
||||
const newChunk: ErroredChunk<any> = createErrorChunk(
|
||||
response,
|
||||
postponeInstance,
|
||||
);
|
||||
chunks.set(id, newChunk);
|
||||
} else {
|
||||
triggerErrorOnChunk(response, chunk, postponeInstance);
|
||||
}
|
||||
}
|
||||
|
||||
function resolvePostponeDev(
|
||||
response: Response,
|
||||
id: number,
|
||||
reason: string,
|
||||
stack: ReactStackTrace,
|
||||
env: string,
|
||||
streamState: StreamState,
|
||||
): void {
|
||||
if (!__DEV__) {
|
||||
// These errors should never make it into a build so we don't need to encode them in codes.json
|
||||
// eslint-disable-next-line react-internal/prod-error-codes
|
||||
throw new Error(
|
||||
'resolvePostponeDev should never be called in production mode. Use resolvePostponeProd instead. This is a bug in React.',
|
||||
);
|
||||
}
|
||||
let postponeInstance: Postpone;
|
||||
const callStack = buildFakeCallStack(
|
||||
response,
|
||||
stack,
|
||||
env,
|
||||
false,
|
||||
// $FlowFixMe[incompatible-use]
|
||||
Error.bind(null, reason || ''),
|
||||
);
|
||||
const rootTask = response._debugRootTask;
|
||||
if (rootTask != null) {
|
||||
postponeInstance = rootTask.run(callStack);
|
||||
} else {
|
||||
postponeInstance = callStack();
|
||||
}
|
||||
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
|
||||
const chunks = response._chunks;
|
||||
const chunk = chunks.get(id);
|
||||
if (!chunk) {
|
||||
const newChunk: ErroredChunk<any> = createErrorChunk(
|
||||
response,
|
||||
postponeInstance,
|
||||
);
|
||||
if (__DEV__) {
|
||||
resolveChunkDebugInfo(response, streamState, newChunk);
|
||||
}
|
||||
chunks.set(id, newChunk);
|
||||
} else {
|
||||
if (__DEV__) {
|
||||
resolveChunkDebugInfo(response, streamState, chunk);
|
||||
}
|
||||
triggerErrorOnChunk(response, chunk, postponeInstance);
|
||||
}
|
||||
}
|
||||
|
||||
function resolveErrorModel(
|
||||
response: Response,
|
||||
id: number,
|
||||
@@ -4893,25 +4807,6 @@ function processFullStringRow(
|
||||
return;
|
||||
}
|
||||
// Fallthrough
|
||||
case 80 /* "P" */: {
|
||||
if (enablePostpone) {
|
||||
if (__DEV__) {
|
||||
const postponeInfo = JSON.parse(row);
|
||||
resolvePostponeDev(
|
||||
response,
|
||||
id,
|
||||
postponeInfo.reason,
|
||||
postponeInfo.stack,
|
||||
postponeInfo.env,
|
||||
streamState,
|
||||
);
|
||||
} else {
|
||||
resolvePostponeProd(response, id, streamState);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Fallthrough
|
||||
default: /* """ "{" "[" "t" "f" "n" "0" - "9" */ {
|
||||
if (__DEV__ && row === '') {
|
||||
resolveDebugHalt(response, id);
|
||||
|
||||
@@ -90,43 +90,6 @@ describe('ReactDOMFizzForm', () => {
|
||||
expect(container.textContent).toEqual('Final');
|
||||
});
|
||||
|
||||
// @gate enablePostpone
|
||||
it(
|
||||
'if initial value postpones during hydration, it will switch to the ' +
|
||||
'final value instead',
|
||||
async () => {
|
||||
function Content() {
|
||||
const isInitial = useDeferredValue(false, true);
|
||||
if (isInitial) {
|
||||
React.unstable_postpone();
|
||||
}
|
||||
return <Text text="Final" />;
|
||||
}
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div>
|
||||
<Suspense fallback={<Text text="Loading..." />}>
|
||||
<Content />
|
||||
</Suspense>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const stream = await serverAct(() =>
|
||||
ReactDOMServer.renderToReadableStream(<App />),
|
||||
);
|
||||
await readIntoContainer(stream);
|
||||
expect(container.textContent).toEqual('Loading...');
|
||||
|
||||
assertLog(['Loading...']);
|
||||
// After hydration, it's updated to the final value
|
||||
await act(() => ReactDOMClient.hydrateRoot(container, <App />));
|
||||
expect(container.textContent).toEqual('Final');
|
||||
assertLog(['Loading...', 'Final']);
|
||||
},
|
||||
);
|
||||
|
||||
it(
|
||||
'useDeferredValue during hydration has higher priority than remaining ' +
|
||||
'incremental hydration',
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -551,45 +551,4 @@ describe('ReactDOMFizzServerBrowser', () => {
|
||||
`"<link rel="preload" as="script" fetchPriority="low" nonce="R4nd0m" href="init.js"/><link rel="modulepreload" fetchPriority="low" nonce="R4nd0m" href="init.mjs"/><div>hello world</div><script nonce="${nonce}" id="_R_">INIT();</script><script src="init.js" nonce="${nonce}" async=""></script><script type="module" src="init.mjs" nonce="${nonce}" async=""></script>"`,
|
||||
);
|
||||
});
|
||||
|
||||
// @gate enablePostpone
|
||||
it('errors if trying to postpone outside a Suspense boundary', async () => {
|
||||
function Postponed() {
|
||||
React.unstable_postpone('testing postpone');
|
||||
return 'client only';
|
||||
}
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div>
|
||||
<Postponed />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const errors = [];
|
||||
const postponed = [];
|
||||
|
||||
let caughtError = null;
|
||||
try {
|
||||
await serverAct(() =>
|
||||
ReactDOMFizzServer.renderToReadableStream(<App />, {
|
||||
onError(error) {
|
||||
errors.push(error.message);
|
||||
},
|
||||
onPostpone(reason) {
|
||||
postponed.push(reason);
|
||||
},
|
||||
}),
|
||||
);
|
||||
} catch (error) {
|
||||
caughtError = error;
|
||||
}
|
||||
|
||||
// Postponing is not logged as an error but as a postponed reason.
|
||||
expect(errors).toEqual([]);
|
||||
expect(postponed).toEqual(['testing postpone']);
|
||||
// However, it does error the shell.
|
||||
expect(caughtError.message).toEqual('testing postpone');
|
||||
});
|
||||
});
|
||||
+1
-39
@@ -231,9 +231,7 @@ describe('ReactDOMFizzStatic', () => {
|
||||
const result = await promise;
|
||||
|
||||
expect(result.postponed).toBe(
|
||||
gate(flags => flags.enableHalt || flags.enablePostpone)
|
||||
? null
|
||||
: undefined,
|
||||
gate(flags => flags.enableHalt) ? null : undefined,
|
||||
);
|
||||
|
||||
await act(async () => {
|
||||
@@ -302,42 +300,6 @@ describe('ReactDOMFizzStatic', () => {
|
||||
expect(getVisibleChildren(container)).toEqual('hello');
|
||||
});
|
||||
|
||||
// @gate enablePostpone
|
||||
it('includes stylesheet preloads in onHeaders when postponing in the Shell', async () => {
|
||||
let headers;
|
||||
function onHeaders(x) {
|
||||
headers = x;
|
||||
}
|
||||
|
||||
function App() {
|
||||
ReactDOM.preload('image', {as: 'image', fetchPriority: 'high'});
|
||||
ReactDOM.preinit('style', {as: 'style'});
|
||||
React.unstable_postpone();
|
||||
return (
|
||||
<html>
|
||||
<body>hello</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
||||
const result = await ReactDOMFizzStatic.prerenderToNodeStream(<App />, {
|
||||
onHeaders,
|
||||
});
|
||||
expect(headers).toEqual({
|
||||
Link: `
|
||||
<image>; rel=preload; as="image"; fetchpriority="high",
|
||||
<style>; rel=preload; as="style"
|
||||
`
|
||||
.replaceAll('\n', '')
|
||||
.trim(),
|
||||
});
|
||||
|
||||
await act(async () => {
|
||||
result.prelude.pipe(writable);
|
||||
});
|
||||
expect(getVisibleChildren(container)).toEqual(undefined);
|
||||
});
|
||||
|
||||
it('will prerender Suspense fallbacks before children', async () => {
|
||||
const values = [];
|
||||
function Indirection({children}) {
|
||||
|
||||
+1
-1207
File diff suppressed because it is too large.
Load diff
@@ -1,283 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @emails react-core
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import {patchMessageChannel} from '../../../../scripts/jest/patchMessageChannel';
|
||||
|
||||
import {
|
||||
getVisibleChildren,
|
||||
insertNodesAndExecuteScripts,
|
||||
} from '../test-utils/FizzTestUtils';
|
||||
|
||||
// Polyfills for test environment
|
||||
global.ReadableStream =
|
||||
require('web-streams-polyfill/ponyfill/es6').ReadableStream;
|
||||
global.TextEncoder = require('util').TextEncoder;
|
||||
|
||||
let React;
|
||||
let ReactDOM;
|
||||
let ReactDOMFizzServer;
|
||||
let ReactDOMFizzStatic;
|
||||
let Suspense;
|
||||
let container;
|
||||
let act;
|
||||
let serverAct;
|
||||
|
||||
describe('ReactDOMFizzStaticFloat', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
patchMessageChannel();
|
||||
act = require('internal-test-utils').act;
|
||||
serverAct = require('internal-test-utils').serverAct;
|
||||
|
||||
React = require('react');
|
||||
ReactDOM = require('react-dom');
|
||||
ReactDOMFizzServer = require('react-dom/server.browser');
|
||||
ReactDOMFizzStatic = require('react-dom/static.browser');
|
||||
Suspense = React.Suspense;
|
||||
container = document.createElement('div');
|
||||
document.body.appendChild(container);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
document.body.removeChild(container);
|
||||
});
|
||||
|
||||
async function readIntoContainer(stream) {
|
||||
const reader = stream.getReader();
|
||||
let result = '';
|
||||
while (true) {
|
||||
const {done, value} = await reader.read();
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
result += Buffer.from(value).toString('utf8');
|
||||
}
|
||||
const temp = document.createElement('div');
|
||||
temp.innerHTML = result;
|
||||
await insertNodesAndExecuteScripts(temp, container, null);
|
||||
}
|
||||
|
||||
// @gate enablePostpone
|
||||
it('should transfer connection credentials across prerender and resume for stylesheets, scripts, and moduleScripts', async () => {
|
||||
let prerendering = true;
|
||||
function Postpone() {
|
||||
if (prerendering) {
|
||||
React.unstable_postpone();
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<link rel="stylesheet" href="style creds" precedence="default" />
|
||||
<script async={true} src="script creds" data-meaningful="" />
|
||||
<script
|
||||
type="module"
|
||||
async={true}
|
||||
src="module creds"
|
||||
data-meaningful=""
|
||||
/>
|
||||
<link rel="stylesheet" href="style anon" precedence="default" />
|
||||
<script async={true} src="script anon" data-meaningful="" />
|
||||
<script
|
||||
type="module"
|
||||
async={true}
|
||||
src="module default"
|
||||
data-meaningful=""
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function App() {
|
||||
ReactDOM.preload('style creds', {
|
||||
as: 'style',
|
||||
crossOrigin: 'use-credentials',
|
||||
});
|
||||
ReactDOM.preload('script creds', {
|
||||
as: 'script',
|
||||
crossOrigin: 'use-credentials',
|
||||
integrity: 'script-hash',
|
||||
});
|
||||
ReactDOM.preloadModule('module creds', {
|
||||
crossOrigin: 'use-credentials',
|
||||
integrity: 'module-hash',
|
||||
});
|
||||
ReactDOM.preload('style anon', {
|
||||
as: 'style',
|
||||
crossOrigin: 'anonymous',
|
||||
});
|
||||
ReactDOM.preload('script anon', {
|
||||
as: 'script',
|
||||
crossOrigin: 'foobar',
|
||||
});
|
||||
ReactDOM.preloadModule('module default', {
|
||||
integrity: 'module-hash',
|
||||
});
|
||||
return (
|
||||
<div>
|
||||
<Suspense fallback="Loading...">
|
||||
<Postpone />
|
||||
</Suspense>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
jest.mock('script creds', () => {}, {
|
||||
virtual: true,
|
||||
});
|
||||
jest.mock('module creds', () => {}, {
|
||||
virtual: true,
|
||||
});
|
||||
jest.mock('script anon', () => {}, {
|
||||
virtual: true,
|
||||
});
|
||||
jest.mock('module default', () => {}, {
|
||||
virtual: true,
|
||||
});
|
||||
|
||||
const prerendered = await serverAct(() =>
|
||||
ReactDOMFizzStatic.prerender(<App />),
|
||||
);
|
||||
expect(prerendered.postponed).not.toBe(null);
|
||||
|
||||
await readIntoContainer(prerendered.prelude);
|
||||
|
||||
expect(getVisibleChildren(container)).toEqual([
|
||||
<link
|
||||
rel="preload"
|
||||
as="style"
|
||||
href="style creds"
|
||||
crossorigin="use-credentials"
|
||||
/>,
|
||||
<link
|
||||
rel="preload"
|
||||
as="script"
|
||||
href="script creds"
|
||||
crossorigin="use-credentials"
|
||||
integrity="script-hash"
|
||||
/>,
|
||||
<link
|
||||
rel="modulepreload"
|
||||
href="module creds"
|
||||
crossorigin="use-credentials"
|
||||
integrity="module-hash"
|
||||
/>,
|
||||
<link rel="preload" as="style" href="style anon" crossorigin="" />,
|
||||
<link rel="preload" as="script" href="script anon" crossorigin="" />,
|
||||
<link
|
||||
rel="modulepreload"
|
||||
href="module default"
|
||||
integrity="module-hash"
|
||||
/>,
|
||||
<div>Loading...</div>,
|
||||
]);
|
||||
|
||||
prerendering = false;
|
||||
const content = await serverAct(() =>
|
||||
ReactDOMFizzServer.resume(
|
||||
<App />,
|
||||
JSON.parse(JSON.stringify(prerendered.postponed)),
|
||||
),
|
||||
);
|
||||
|
||||
await readIntoContainer(content);
|
||||
|
||||
await act(() => {
|
||||
// Dispatch load event to injected stylesheet
|
||||
const linkCreds = document.querySelector(
|
||||
'link[rel="stylesheet"][href="style creds"]',
|
||||
);
|
||||
const linkAnon = document.querySelector(
|
||||
'link[rel="stylesheet"][href="style anon"]',
|
||||
);
|
||||
const event = document.createEvent('Events');
|
||||
event.initEvent('load', true, true);
|
||||
linkCreds.dispatchEvent(event);
|
||||
linkAnon.dispatchEvent(event);
|
||||
});
|
||||
|
||||
expect(getVisibleChildren(document)).toEqual(
|
||||
<html>
|
||||
<head>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
data-precedence="default"
|
||||
href="style creds"
|
||||
crossorigin="use-credentials"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
data-precedence="default"
|
||||
href="style anon"
|
||||
crossorigin=""
|
||||
/>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<link
|
||||
rel="preload"
|
||||
as="style"
|
||||
href="style creds"
|
||||
crossorigin="use-credentials"
|
||||
/>
|
||||
<link
|
||||
rel="preload"
|
||||
as="script"
|
||||
href="script creds"
|
||||
crossorigin="use-credentials"
|
||||
integrity="script-hash"
|
||||
/>
|
||||
<link
|
||||
rel="modulepreload"
|
||||
href="module creds"
|
||||
crossorigin="use-credentials"
|
||||
integrity="module-hash"
|
||||
/>
|
||||
<link rel="preload" as="style" href="style anon" crossorigin="" />
|
||||
<link rel="preload" as="script" href="script anon" crossorigin="" />
|
||||
<link
|
||||
rel="modulepreload"
|
||||
href="module default"
|
||||
integrity="module-hash"
|
||||
/>
|
||||
<div />
|
||||
<script
|
||||
async=""
|
||||
src="script creds"
|
||||
crossorigin="use-credentials"
|
||||
integrity="script-hash"
|
||||
data-meaningful=""
|
||||
/>
|
||||
<script
|
||||
type="module"
|
||||
async=""
|
||||
src="module creds"
|
||||
crossorigin="use-credentials"
|
||||
integrity="module-hash"
|
||||
data-meaningful=""
|
||||
/>
|
||||
<script
|
||||
async=""
|
||||
src="script anon"
|
||||
crossorigin=""
|
||||
data-meaningful=""
|
||||
/>
|
||||
<script
|
||||
type="module"
|
||||
async=""
|
||||
src="module default"
|
||||
integrity="module-hash"
|
||||
data-meaningful=""
|
||||
/>
|
||||
</div>
|
||||
</body>
|
||||
</html>,
|
||||
);
|
||||
});
|
||||
});
|
||||
+14
-14
@@ -56,7 +56,7 @@ describe('ReactDOMFizzStaticNode', () => {
|
||||
}
|
||||
}
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('should call prerenderToNodeStream', async () => {
|
||||
const result = await ReactDOMFizzStatic.prerenderToNodeStream(
|
||||
<div>hello world</div>,
|
||||
@@ -65,14 +65,14 @@ describe('ReactDOMFizzStaticNode', () => {
|
||||
expect(prelude).toMatchInlineSnapshot(`"<div>hello world</div>"`);
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('should suppport web streams', async () => {
|
||||
const result = await ReactDOMFizzStatic.prerender(<div>hello world</div>);
|
||||
const prelude = await readContentWeb(result.prelude);
|
||||
expect(prelude).toMatchInlineSnapshot(`"<div>hello world</div>"`);
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('should emit DOCTYPE at the root of the document', async () => {
|
||||
const result = await ReactDOMFizzStatic.prerenderToNodeStream(
|
||||
<html>
|
||||
@@ -91,7 +91,7 @@ describe('ReactDOMFizzStaticNode', () => {
|
||||
}
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('should emit bootstrap script src at the end', async () => {
|
||||
const result = await ReactDOMFizzStatic.prerenderToNodeStream(
|
||||
<div>hello world</div>,
|
||||
@@ -107,7 +107,7 @@ describe('ReactDOMFizzStaticNode', () => {
|
||||
);
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('emits all HTML as one unit', async () => {
|
||||
let hasLoaded = false;
|
||||
let resolve;
|
||||
@@ -137,7 +137,7 @@ describe('ReactDOMFizzStaticNode', () => {
|
||||
expect(prelude).toMatchInlineSnapshot(`"<div><!--$-->Done<!--/$--></div>"`);
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('should reject the promise when an error is thrown at the root', async () => {
|
||||
const reportedErrors = [];
|
||||
let caughtError = null;
|
||||
@@ -159,7 +159,7 @@ describe('ReactDOMFizzStaticNode', () => {
|
||||
expect(reportedErrors).toEqual([theError]);
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('should reject the promise when an error is thrown inside a fallback', async () => {
|
||||
const reportedErrors = [];
|
||||
let caughtError = null;
|
||||
@@ -183,7 +183,7 @@ describe('ReactDOMFizzStaticNode', () => {
|
||||
expect(reportedErrors).toEqual([theError]);
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('should not error the stream when an error is thrown inside suspense boundary', async () => {
|
||||
const reportedErrors = [];
|
||||
const result = await ReactDOMFizzStatic.prerenderToNodeStream(
|
||||
@@ -204,7 +204,7 @@ describe('ReactDOMFizzStaticNode', () => {
|
||||
expect(reportedErrors).toEqual([theError]);
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('should be able to complete by aborting even if the promise never resolves', async () => {
|
||||
const errors = [];
|
||||
const controller = new AbortController();
|
||||
@@ -234,7 +234,7 @@ describe('ReactDOMFizzStaticNode', () => {
|
||||
expect(errors).toEqual(['This operation was aborted']);
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
// @gate !enableHalt
|
||||
it('should reject if aborting before the shell is complete and enableHalt is disabled', async () => {
|
||||
const errors = [];
|
||||
@@ -300,7 +300,7 @@ describe('ReactDOMFizzStaticNode', () => {
|
||||
expect(content).toBe('');
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('should be able to abort before something suspends', async () => {
|
||||
const errors = [];
|
||||
const controller = new AbortController();
|
||||
@@ -341,7 +341,7 @@ describe('ReactDOMFizzStaticNode', () => {
|
||||
}
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
// @gate !enableHalt
|
||||
it('should reject if passing an already aborted signal and enableHalt is disabled', async () => {
|
||||
const errors = [];
|
||||
@@ -412,7 +412,7 @@ describe('ReactDOMFizzStaticNode', () => {
|
||||
expect(content).toBe('');
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('supports custom abort reasons with a string', async () => {
|
||||
const promise = new Promise(r => {});
|
||||
function Wait() {
|
||||
@@ -454,7 +454,7 @@ describe('ReactDOMFizzStaticNode', () => {
|
||||
expect(errors).toEqual(['foobar', 'foobar']);
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('supports custom abort reasons with an Error', async () => {
|
||||
const promise = new Promise(r => {});
|
||||
function Wait() {
|
||||
|
||||
@@ -7,11 +7,7 @@
|
||||
* @flow
|
||||
*/
|
||||
|
||||
import type {
|
||||
PostponedState,
|
||||
ErrorInfo,
|
||||
PostponeInfo,
|
||||
} from 'react-server/src/ReactFizzServer';
|
||||
import type {PostponedState, ErrorInfo} from 'react-server/src/ReactFizzServer';
|
||||
import type {ReactNodeList, ReactFormState} from 'shared/ReactTypes';
|
||||
import type {
|
||||
BootstrapScriptDescriptor,
|
||||
@@ -57,7 +53,6 @@ type Options = {
|
||||
progressiveChunkSize?: number,
|
||||
signal?: AbortSignal,
|
||||
onError?: (error: mixed, errorInfo: ErrorInfo) => ?string,
|
||||
onPostpone?: (reason: string, postponeInfo: PostponeInfo) => void,
|
||||
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
|
||||
importMap?: ImportMap,
|
||||
formState?: ReactFormState<any, any> | null,
|
||||
@@ -69,7 +64,6 @@ type ResumeOptions = {
|
||||
nonce?: NonceOption,
|
||||
signal?: AbortSignal,
|
||||
onError?: (error: mixed) => ?string,
|
||||
onPostpone?: (reason: string) => void,
|
||||
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
|
||||
};
|
||||
|
||||
@@ -150,7 +144,6 @@ function renderToReadableStream(
|
||||
onShellReady,
|
||||
onShellError,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.formState : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
@@ -220,7 +213,6 @@ function resume(
|
||||
onShellReady,
|
||||
onShellError,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
const signal = options.signal;
|
||||
|
||||
+1
-3
@@ -13,7 +13,7 @@ import type {
|
||||
HeadersDescriptor,
|
||||
} from 'react-dom-bindings/src/server/ReactFizzConfigDOM';
|
||||
import type {ImportMap} from '../shared/ReactDOMTypes';
|
||||
import type {ErrorInfo, PostponeInfo} from 'react-server/src/ReactFizzServer';
|
||||
import type {ErrorInfo} from 'react-server/src/ReactFizzServer';
|
||||
|
||||
import ReactVersion from 'shared/ReactVersion';
|
||||
|
||||
@@ -49,7 +49,6 @@ type Options = {
|
||||
progressiveChunkSize?: number,
|
||||
signal?: AbortSignal,
|
||||
onError?: (error: mixed, errorInfo: ErrorInfo) => ?string,
|
||||
onPostpone?: (reason: string, postponeInfo: PostponeInfo) => void,
|
||||
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
|
||||
importMap?: ImportMap,
|
||||
formState?: ReactFormState<any, any> | null,
|
||||
@@ -135,7 +134,6 @@ function renderToReadableStream(
|
||||
onShellReady,
|
||||
onShellError,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.formState : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
|
||||
+1
-9
@@ -7,11 +7,7 @@
|
||||
* @flow
|
||||
*/
|
||||
|
||||
import type {
|
||||
PostponedState,
|
||||
ErrorInfo,
|
||||
PostponeInfo,
|
||||
} from 'react-server/src/ReactFizzServer';
|
||||
import type {PostponedState, ErrorInfo} from 'react-server/src/ReactFizzServer';
|
||||
import type {ReactNodeList, ReactFormState} from 'shared/ReactTypes';
|
||||
import type {
|
||||
BootstrapScriptDescriptor,
|
||||
@@ -57,7 +53,6 @@ type Options = {
|
||||
progressiveChunkSize?: number,
|
||||
signal?: AbortSignal,
|
||||
onError?: (error: mixed, errorInfo: ErrorInfo) => ?string,
|
||||
onPostpone?: (reason: string, postponeInfo: PostponeInfo) => void,
|
||||
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
|
||||
importMap?: ImportMap,
|
||||
formState?: ReactFormState<any, any> | null,
|
||||
@@ -69,7 +64,6 @@ type ResumeOptions = {
|
||||
nonce?: NonceOption,
|
||||
signal?: AbortSignal,
|
||||
onError?: (error: mixed) => ?string,
|
||||
onPostpone?: (reason: string) => void,
|
||||
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
|
||||
};
|
||||
|
||||
@@ -150,7 +144,6 @@ function renderToReadableStream(
|
||||
onShellReady,
|
||||
onShellError,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.formState : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
@@ -220,7 +213,6 @@ function resume(
|
||||
onShellReady,
|
||||
onShellError,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
const signal = options.signal;
|
||||
|
||||
@@ -11,7 +11,6 @@ import type {
|
||||
Request,
|
||||
PostponedState,
|
||||
ErrorInfo,
|
||||
PostponeInfo,
|
||||
} from 'react-server/src/ReactFizzServer';
|
||||
import type {ReactNodeList, ReactFormState} from 'shared/ReactTypes';
|
||||
import type {Writable} from 'stream';
|
||||
@@ -77,7 +76,6 @@ type Options = {
|
||||
onShellError?: (error: mixed) => void,
|
||||
onAllReady?: () => void,
|
||||
onError?: (error: mixed, errorInfo: ErrorInfo) => ?string,
|
||||
onPostpone?: (reason: string, postponeInfo: PostponeInfo) => void,
|
||||
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
|
||||
importMap?: ImportMap,
|
||||
formState?: ReactFormState<any, any> | null,
|
||||
@@ -91,7 +89,6 @@ type ResumeOptions = {
|
||||
onShellError?: (error: mixed) => void,
|
||||
onAllReady?: () => void,
|
||||
onError?: (error: mixed, errorInfo: ErrorInfo) => ?string,
|
||||
onPostpone?: (reason: string, postponeInfo: PostponeInfo) => void,
|
||||
};
|
||||
|
||||
type PipeableStream = {
|
||||
@@ -127,7 +124,6 @@ function createRequestImpl(children: ReactNodeList, options: void | Options) {
|
||||
options ? options.onShellReady : undefined,
|
||||
options ? options.onShellError : undefined,
|
||||
undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.formState : undefined,
|
||||
);
|
||||
}
|
||||
@@ -285,7 +281,6 @@ function renderToReadableStream(
|
||||
onShellReady,
|
||||
onShellError,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.formState : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
@@ -321,7 +316,6 @@ function resumeRequestImpl(
|
||||
options ? options.onShellReady : undefined,
|
||||
options ? options.onShellError : undefined,
|
||||
undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -423,7 +417,6 @@ function resume(
|
||||
onShellReady,
|
||||
onShellError,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
const signal = options.signal;
|
||||
|
||||
+10
-19
@@ -12,11 +12,7 @@ import type {
|
||||
BootstrapScriptDescriptor,
|
||||
HeadersDescriptor,
|
||||
} from 'react-dom-bindings/src/server/ReactFizzConfigDOM';
|
||||
import type {
|
||||
PostponedState,
|
||||
ErrorInfo,
|
||||
PostponeInfo,
|
||||
} from 'react-server/src/ReactFizzServer';
|
||||
import type {PostponedState, ErrorInfo} from 'react-server/src/ReactFizzServer';
|
||||
import type {ImportMap} from '../shared/ReactDOMTypes';
|
||||
|
||||
import ReactVersion from 'shared/ReactVersion';
|
||||
@@ -38,7 +34,7 @@ import {
|
||||
createRootFormatContext,
|
||||
} from 'react-dom-bindings/src/server/ReactFizzConfigDOM';
|
||||
|
||||
import {enablePostpone, enableHalt} from 'shared/ReactFeatureFlags';
|
||||
import {enableHalt} from 'shared/ReactFeatureFlags';
|
||||
|
||||
import {ensureCorrectIsomorphicReactVersion} from '../shared/ensureCorrectIsomorphicReactVersion';
|
||||
ensureCorrectIsomorphicReactVersion();
|
||||
@@ -59,7 +55,6 @@ type Options = {
|
||||
progressiveChunkSize?: number,
|
||||
signal?: AbortSignal,
|
||||
onError?: (error: mixed, errorInfo: ErrorInfo) => ?string,
|
||||
onPostpone?: (reason: string, postponeInfo: PostponeInfo) => void,
|
||||
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
|
||||
importMap?: ImportMap,
|
||||
onHeaders?: (headers: Headers) => void,
|
||||
@@ -94,15 +89,14 @@ function prerender(
|
||||
{highWaterMark: 0},
|
||||
);
|
||||
|
||||
const result: StaticResult =
|
||||
enablePostpone || enableHalt
|
||||
? {
|
||||
postponed: getPostponedState(request),
|
||||
prelude: stream,
|
||||
}
|
||||
: ({
|
||||
prelude: stream,
|
||||
}: any);
|
||||
const result: StaticResult = enableHalt
|
||||
? {
|
||||
postponed: getPostponedState(request),
|
||||
prelude: stream,
|
||||
}
|
||||
: ({
|
||||
prelude: stream,
|
||||
}: any);
|
||||
resolve(result);
|
||||
}
|
||||
|
||||
@@ -139,7 +133,6 @@ function prerender(
|
||||
undefined,
|
||||
undefined,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
const signal = options.signal;
|
||||
@@ -161,7 +154,6 @@ type ResumeOptions = {
|
||||
nonce?: NonceOption,
|
||||
signal?: AbortSignal,
|
||||
onError?: (error: mixed) => ?string,
|
||||
onPostpone?: (reason: string) => void,
|
||||
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
|
||||
};
|
||||
|
||||
@@ -205,7 +197,6 @@ function resumeAndPrerender(
|
||||
undefined,
|
||||
undefined,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
const signal = options.signal;
|
||||
|
||||
+10
-19
@@ -12,11 +12,7 @@ import type {
|
||||
BootstrapScriptDescriptor,
|
||||
HeadersDescriptor,
|
||||
} from 'react-dom-bindings/src/server/ReactFizzConfigDOM';
|
||||
import type {
|
||||
PostponedState,
|
||||
ErrorInfo,
|
||||
PostponeInfo,
|
||||
} from 'react-server/src/ReactFizzServer';
|
||||
import type {PostponedState, ErrorInfo} from 'react-server/src/ReactFizzServer';
|
||||
import type {ImportMap} from '../shared/ReactDOMTypes';
|
||||
|
||||
import ReactVersion from 'shared/ReactVersion';
|
||||
@@ -38,7 +34,7 @@ import {
|
||||
createRootFormatContext,
|
||||
} from 'react-dom-bindings/src/server/ReactFizzConfigDOM';
|
||||
|
||||
import {enablePostpone, enableHalt} from 'shared/ReactFeatureFlags';
|
||||
import {enableHalt} from 'shared/ReactFeatureFlags';
|
||||
|
||||
import {ensureCorrectIsomorphicReactVersion} from '../shared/ensureCorrectIsomorphicReactVersion';
|
||||
ensureCorrectIsomorphicReactVersion();
|
||||
@@ -59,7 +55,6 @@ type Options = {
|
||||
progressiveChunkSize?: number,
|
||||
signal?: AbortSignal,
|
||||
onError?: (error: mixed, errorInfo: ErrorInfo) => ?string,
|
||||
onPostpone?: (reason: string, postponeInfo: PostponeInfo) => void,
|
||||
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
|
||||
importMap?: ImportMap,
|
||||
onHeaders?: (headers: Headers) => void,
|
||||
@@ -94,15 +89,14 @@ function prerender(
|
||||
{highWaterMark: 0},
|
||||
);
|
||||
|
||||
const result: StaticResult =
|
||||
enablePostpone || enableHalt
|
||||
? {
|
||||
postponed: getPostponedState(request),
|
||||
prelude: stream,
|
||||
}
|
||||
: ({
|
||||
prelude: stream,
|
||||
}: any);
|
||||
const result: StaticResult = enableHalt
|
||||
? {
|
||||
postponed: getPostponedState(request),
|
||||
prelude: stream,
|
||||
}
|
||||
: ({
|
||||
prelude: stream,
|
||||
}: any);
|
||||
resolve(result);
|
||||
}
|
||||
|
||||
@@ -138,7 +132,6 @@ function prerender(
|
||||
undefined,
|
||||
undefined,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
const signal = options.signal;
|
||||
@@ -160,7 +153,6 @@ type ResumeOptions = {
|
||||
nonce?: NonceOption,
|
||||
signal?: AbortSignal,
|
||||
onError?: (error: mixed, errorInfo: ErrorInfo) => ?string,
|
||||
onPostpone?: (reason: string, postponeInfo: PostponeInfo) => void,
|
||||
};
|
||||
|
||||
function resumeAndPrerender(
|
||||
@@ -203,7 +195,6 @@ function resumeAndPrerender(
|
||||
undefined,
|
||||
undefined,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
const signal = options.signal;
|
||||
|
||||
+18
-30
@@ -12,11 +12,7 @@ import type {
|
||||
BootstrapScriptDescriptor,
|
||||
HeadersDescriptor,
|
||||
} from 'react-dom-bindings/src/server/ReactFizzConfigDOM';
|
||||
import type {
|
||||
PostponedState,
|
||||
ErrorInfo,
|
||||
PostponeInfo,
|
||||
} from 'react-server/src/ReactFizzServer';
|
||||
import type {PostponedState, ErrorInfo} from 'react-server/src/ReactFizzServer';
|
||||
import type {ImportMap} from '../shared/ReactDOMTypes';
|
||||
|
||||
import {Writable, Readable} from 'stream';
|
||||
@@ -40,7 +36,7 @@ import {
|
||||
createRootFormatContext,
|
||||
} from 'react-dom-bindings/src/server/ReactFizzConfigDOM';
|
||||
|
||||
import {enablePostpone, enableHalt} from 'shared/ReactFeatureFlags';
|
||||
import {enableHalt} from 'shared/ReactFeatureFlags';
|
||||
|
||||
import {textEncoder} from 'react-server/src/ReactServerStreamConfigNode';
|
||||
|
||||
@@ -63,7 +59,6 @@ type Options = {
|
||||
progressiveChunkSize?: number,
|
||||
signal?: AbortSignal,
|
||||
onError?: (error: mixed, errorInfo: ErrorInfo) => ?string,
|
||||
onPostpone?: (reason: string, postponeInfo: PostponeInfo) => void,
|
||||
unstable_externalRuntimeSrc?: string | BootstrapScriptDescriptor,
|
||||
importMap?: ImportMap,
|
||||
onHeaders?: (headers: HeadersDescriptor) => void,
|
||||
@@ -135,15 +130,14 @@ function prerenderToNodeStream(
|
||||
});
|
||||
const writable = createFakeWritableFromReadable(readable);
|
||||
|
||||
const result: StaticResult =
|
||||
enablePostpone || enableHalt
|
||||
? {
|
||||
postponed: getPostponedState(request),
|
||||
prelude: readable,
|
||||
}
|
||||
: ({
|
||||
prelude: readable,
|
||||
}: any);
|
||||
const result: StaticResult = enableHalt
|
||||
? {
|
||||
postponed: getPostponedState(request),
|
||||
prelude: readable,
|
||||
}
|
||||
: ({
|
||||
prelude: readable,
|
||||
}: any);
|
||||
resolve(result);
|
||||
}
|
||||
const resumableState = createResumableState(
|
||||
@@ -171,7 +165,6 @@ function prerenderToNodeStream(
|
||||
undefined,
|
||||
undefined,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
const signal = options.signal;
|
||||
@@ -222,15 +215,14 @@ function prerender(
|
||||
{highWaterMark: 0},
|
||||
);
|
||||
|
||||
const result =
|
||||
enablePostpone || enableHalt
|
||||
? {
|
||||
postponed: getPostponedState(request),
|
||||
prelude: stream,
|
||||
}
|
||||
: ({
|
||||
prelude: stream,
|
||||
}: any);
|
||||
const result = enableHalt
|
||||
? {
|
||||
postponed: getPostponedState(request),
|
||||
prelude: stream,
|
||||
}
|
||||
: ({
|
||||
prelude: stream,
|
||||
}: any);
|
||||
resolve(result);
|
||||
}
|
||||
|
||||
@@ -266,7 +258,6 @@ function prerender(
|
||||
undefined,
|
||||
undefined,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
const signal = options.signal;
|
||||
@@ -288,7 +279,6 @@ type ResumeOptions = {
|
||||
nonce?: NonceOption,
|
||||
signal?: AbortSignal,
|
||||
onError?: (error: mixed, errorInfo: ErrorInfo) => ?string,
|
||||
onPostpone?: (reason: string, postponeInfo: PostponeInfo) => void,
|
||||
};
|
||||
|
||||
function resumeAndPrerenderToNodeStream(
|
||||
@@ -322,7 +312,6 @@ function resumeAndPrerenderToNodeStream(
|
||||
undefined,
|
||||
undefined,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
const signal = options.signal;
|
||||
@@ -388,7 +377,6 @@ function resumeAndPrerender(
|
||||
undefined,
|
||||
undefined,
|
||||
onFatalError,
|
||||
options ? options.onPostpone : undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
const signal = options.signal;
|
||||
|
||||
@@ -85,7 +85,6 @@ export function experimental_renderToHTML(
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
const signal = options.signal;
|
||||
|
||||
@@ -184,7 +184,6 @@ export function experimental_renderToHTML(
|
||||
handleFlightError,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
'Markup',
|
||||
undefined,
|
||||
false,
|
||||
@@ -214,7 +213,6 @@ export function experimental_renderToHTML(
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
);
|
||||
if (options && options.signal) {
|
||||
const signal = options.signal;
|
||||
|
||||
@@ -73,7 +73,6 @@ type Options = {
|
||||
signal?: AbortSignal,
|
||||
debugChannel?: {onMessage?: (message: string) => void},
|
||||
onError?: (error: mixed) => void,
|
||||
onPostpone?: (reason: string) => void,
|
||||
};
|
||||
|
||||
function render(model: ReactClientValue, options?: Options): Destination {
|
||||
@@ -84,7 +83,6 @@ function render(model: ReactClientValue, options?: Options): Destination {
|
||||
bundlerConfig,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
|
||||
+17
-21
@@ -115,7 +115,6 @@ import {
|
||||
enableTransitionTracing,
|
||||
enableLegacyHidden,
|
||||
enableCPUSuspense,
|
||||
enablePostpone,
|
||||
disableLegacyMode,
|
||||
enableHydrationLaneScheduling,
|
||||
enableViewTransition,
|
||||
@@ -2973,28 +2972,25 @@ function updateDehydratedSuspenseComponent(
|
||||
({digest} = getSuspenseInstanceFallbackErrorDetails(suspenseInstance));
|
||||
}
|
||||
|
||||
// TODO: Figure out a better signal than encoding a magic digest value.
|
||||
if (!enablePostpone || digest !== 'POSTPONE') {
|
||||
let error: Error;
|
||||
if (__DEV__ && message) {
|
||||
// eslint-disable-next-line react-internal/prod-error-codes
|
||||
error = new Error(message);
|
||||
} else {
|
||||
error = new Error(
|
||||
'The server could not finish this Suspense boundary, likely ' +
|
||||
'due to an error during server rendering. ' +
|
||||
'Switched to client rendering.',
|
||||
);
|
||||
}
|
||||
// Replace the stack with the server stack
|
||||
error.stack = (__DEV__ && stack) || '';
|
||||
(error: any).digest = digest;
|
||||
const capturedValue = createCapturedValueFromError(
|
||||
error,
|
||||
componentStack === undefined ? null : componentStack,
|
||||
let error: Error;
|
||||
if (__DEV__ && message) {
|
||||
// eslint-disable-next-line react-internal/prod-error-codes
|
||||
error = new Error(message);
|
||||
} else {
|
||||
error = new Error(
|
||||
'The server could not finish this Suspense boundary, likely ' +
|
||||
'due to an error during server rendering. ' +
|
||||
'Switched to client rendering.',
|
||||
);
|
||||
queueHydrationError(capturedValue);
|
||||
}
|
||||
// Replace the stack with the server stack
|
||||
error.stack = (__DEV__ && stack) || '';
|
||||
(error: any).digest = digest;
|
||||
const capturedValue = createCapturedValueFromError(
|
||||
error,
|
||||
componentStack === undefined ? null : componentStack,
|
||||
);
|
||||
queueHydrationError(capturedValue);
|
||||
return retrySuspenseComponentWithoutHydrating(
|
||||
current,
|
||||
workInProgress,
|
||||
|
||||
+2
-2
@@ -3767,7 +3767,7 @@ function commitPassiveMountOnFiber(
|
||||
inHydratedSubtree = false;
|
||||
const hydrationErrors = prevState.hydrationErrors;
|
||||
// If there were no hydration errors, that suggests that this was an intentional client
|
||||
// rendered boundary. Such as postpone.
|
||||
// rendered boundary.
|
||||
if (hydrationErrors !== null) {
|
||||
const startTime: number = (finishedWork.actualStartTime: any);
|
||||
logComponentErrored(
|
||||
@@ -3825,7 +3825,7 @@ function commitPassiveMountOnFiber(
|
||||
inHydratedSubtree = false;
|
||||
const hydrationErrors = prevState.hydrationErrors;
|
||||
// If there were no hydration errors, that suggests that this was an intentional client
|
||||
// rendered boundary. Such as postpone.
|
||||
// rendered boundary.
|
||||
if (hydrationErrors !== null) {
|
||||
const startTime: number = (finishedWork.actualStartTime: any);
|
||||
logComponentErrored(
|
||||
|
||||
@@ -42,7 +42,6 @@ import {
|
||||
import {NoMode, ConcurrentMode} from './ReactTypeOfMode';
|
||||
import {
|
||||
enableUpdaterTracking,
|
||||
enablePostpone,
|
||||
disableLegacyMode,
|
||||
} from 'shared/ReactFeatureFlags';
|
||||
import {createCapturedValueAtFiber} from './ReactCapturedValue';
|
||||
@@ -85,7 +84,6 @@ import {
|
||||
} from './ReactFiberHydrationContext';
|
||||
import {ConcurrentRoot} from './ReactRootTags';
|
||||
import {noopSuspenseyCommitThenable} from './ReactFiberThenable';
|
||||
import {REACT_POSTPONE_TYPE} from 'shared/ReactSymbols';
|
||||
import {runWithFiberInDEV} from './ReactCurrentFiber';
|
||||
import {callComponentDidCatchInDEV} from './ReactFiberCallUserSpace';
|
||||
|
||||
@@ -378,10 +376,6 @@ function throwException(
|
||||
}
|
||||
|
||||
if (value !== null && typeof value === 'object') {
|
||||
if (enablePostpone && value.$$typeof === REACT_POSTPONE_TYPE) {
|
||||
// Act as if this is an infinitely suspending promise.
|
||||
value = {then: function () {}};
|
||||
}
|
||||
if (typeof value.then === 'function') {
|
||||
// This is a wakeable. The component suspended.
|
||||
const wakeable: Wakeable = (value: any);
|
||||
|
||||
@@ -144,7 +144,6 @@ type Options = {
|
||||
environmentName?: string | (() => string),
|
||||
filterStackFrame?: (url: string, functionName: string) => boolean,
|
||||
onError?: (error: mixed) => void,
|
||||
onPostpone?: (reason: string) => void,
|
||||
identifierPrefix?: string,
|
||||
temporaryReferences?: TemporaryReferenceSet,
|
||||
};
|
||||
@@ -183,7 +182,6 @@ function renderToPipeableStream(
|
||||
moduleBasePath,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
@@ -271,7 +269,6 @@ type PrerenderOptions = {
|
||||
environmentName?: string | (() => string),
|
||||
filterStackFrame?: (url: string, functionName: string) => boolean,
|
||||
onError?: (error: mixed) => void,
|
||||
onPostpone?: (reason: string) => void,
|
||||
identifierPrefix?: string,
|
||||
temporaryReferences?: TemporaryReferenceSet,
|
||||
signal?: AbortSignal,
|
||||
@@ -305,7 +302,6 @@ function prerenderToNodeStream(
|
||||
onFatalError,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
|
||||
@@ -67,7 +67,6 @@ type Options = {
|
||||
signal?: AbortSignal,
|
||||
temporaryReferences?: TemporaryReferenceSet,
|
||||
onError?: (error: mixed) => void,
|
||||
onPostpone?: (reason: string) => void,
|
||||
};
|
||||
|
||||
function startReadingFromDebugChannelReadableStream(
|
||||
@@ -128,7 +127,6 @@ export function renderToReadableStream(
|
||||
null,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
@@ -216,7 +214,6 @@ export function prerender(
|
||||
onFatalError,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
|
||||
@@ -72,7 +72,6 @@ type Options = {
|
||||
signal?: AbortSignal,
|
||||
temporaryReferences?: TemporaryReferenceSet,
|
||||
onError?: (error: mixed) => void,
|
||||
onPostpone?: (reason: string) => void,
|
||||
};
|
||||
|
||||
function startReadingFromDebugChannelReadableStream(
|
||||
@@ -133,7 +132,6 @@ export function renderToReadableStream(
|
||||
null,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
@@ -221,7 +219,6 @@ export function prerender(
|
||||
onFatalError,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
|
||||
@@ -157,7 +157,6 @@ type Options = {
|
||||
environmentName?: string | (() => string),
|
||||
filterStackFrame?: (url: string, functionName: string) => boolean,
|
||||
onError?: (error: mixed) => void,
|
||||
onPostpone?: (reason: string) => void,
|
||||
identifierPrefix?: string,
|
||||
temporaryReferences?: TemporaryReferenceSet,
|
||||
};
|
||||
@@ -195,7 +194,6 @@ export function renderToPipeableStream(
|
||||
null,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
@@ -353,7 +351,6 @@ export function renderToReadableStream(
|
||||
null,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
@@ -434,7 +431,6 @@ type PrerenderOptions = {
|
||||
environmentName?: string | (() => string),
|
||||
filterStackFrame?: (url: string, functionName: string) => boolean,
|
||||
onError?: (error: mixed) => void,
|
||||
onPostpone?: (reason: string) => void,
|
||||
identifierPrefix?: string,
|
||||
temporaryReferences?: TemporaryReferenceSet,
|
||||
signal?: AbortSignal,
|
||||
@@ -467,7 +463,6 @@ export function prerenderToNodeStream(
|
||||
onFatalError,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
@@ -530,7 +525,6 @@ export function prerender(
|
||||
onFatalError,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
|
||||
@@ -64,7 +64,6 @@ type Options = {
|
||||
signal?: AbortSignal,
|
||||
temporaryReferences?: TemporaryReferenceSet,
|
||||
onError?: (error: mixed) => void,
|
||||
onPostpone?: (reason: string) => void,
|
||||
};
|
||||
|
||||
function startReadingFromDebugChannelReadableStream(
|
||||
@@ -126,7 +125,6 @@ function renderToReadableStream(
|
||||
turbopackMap,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
@@ -215,7 +213,6 @@ function prerender(
|
||||
onFatalError,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
|
||||
@@ -69,7 +69,6 @@ type Options = {
|
||||
signal?: AbortSignal,
|
||||
temporaryReferences?: TemporaryReferenceSet,
|
||||
onError?: (error: mixed) => void,
|
||||
onPostpone?: (reason: string) => void,
|
||||
};
|
||||
|
||||
function startReadingFromDebugChannelReadableStream(
|
||||
@@ -131,7 +130,6 @@ function renderToReadableStream(
|
||||
turbopackMap,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
@@ -220,7 +218,6 @@ function prerender(
|
||||
onFatalError,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
|
||||
@@ -150,7 +150,6 @@ type Options = {
|
||||
environmentName?: string | (() => string),
|
||||
filterStackFrame?: (url: string, functionName: string) => boolean,
|
||||
onError?: (error: mixed) => void,
|
||||
onPostpone?: (reason: string) => void,
|
||||
identifierPrefix?: string,
|
||||
temporaryReferences?: TemporaryReferenceSet,
|
||||
};
|
||||
@@ -189,7 +188,6 @@ function renderToPipeableStream(
|
||||
turbopackMap,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
@@ -348,7 +346,6 @@ function renderToReadableStream(
|
||||
turbopackMap,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
@@ -429,7 +426,6 @@ type PrerenderOptions = {
|
||||
environmentName?: string | (() => string),
|
||||
filterStackFrame?: (url: string, functionName: string) => boolean,
|
||||
onError?: (error: mixed) => void,
|
||||
onPostpone?: (reason: string) => void,
|
||||
identifierPrefix?: string,
|
||||
temporaryReferences?: TemporaryReferenceSet,
|
||||
signal?: AbortSignal,
|
||||
@@ -463,7 +459,6 @@ function prerenderToNodeStream(
|
||||
onFatalError,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
@@ -527,7 +522,6 @@ function prerender(
|
||||
onFatalError,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
|
||||
@@ -34,7 +34,6 @@ let ReactServerDOMServer;
|
||||
let ReactServerDOMStaticServer;
|
||||
let ReactServerDOMClient;
|
||||
let ReactDOMFizzServer;
|
||||
let ReactDOMStaticServer;
|
||||
let Suspense;
|
||||
let ErrorBoundary;
|
||||
let JSDOM;
|
||||
@@ -88,7 +87,6 @@ describe('ReactFlightDOM', () => {
|
||||
Suspense = React.Suspense;
|
||||
ReactDOMClient = require('react-dom/client');
|
||||
ReactDOMFizzServer = require('react-dom/server.node');
|
||||
ReactDOMStaticServer = require('react-dom/static.node');
|
||||
ReactServerDOMClient = require('react-server-dom-webpack/client');
|
||||
|
||||
ErrorBoundary = class extends React.Component {
|
||||
@@ -1633,89 +1631,6 @@ describe('ReactFlightDOM', () => {
|
||||
expect(getMeaningfulChildren(container)).toEqual(<p>hello world</p>);
|
||||
});
|
||||
|
||||
// @gate enablePostpone
|
||||
it('should allow postponing in Flight through a serialized promise', async () => {
|
||||
const Context = React.createContext();
|
||||
const ContextProvider = Context.Provider;
|
||||
|
||||
function Foo() {
|
||||
const value = React.use(React.useContext(Context));
|
||||
return <span>{value}</span>;
|
||||
}
|
||||
|
||||
const ClientModule = clientExports({
|
||||
ContextProvider,
|
||||
Foo,
|
||||
});
|
||||
|
||||
async function getFoo() {
|
||||
React.unstable_postpone('foo');
|
||||
}
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<ClientModule.ContextProvider value={getFoo()}>
|
||||
<div>
|
||||
<Suspense fallback="loading...">
|
||||
<ClientModule.Foo />
|
||||
</Suspense>
|
||||
</div>
|
||||
</ClientModule.ContextProvider>
|
||||
);
|
||||
}
|
||||
|
||||
const {writable, readable} = getTestStream();
|
||||
|
||||
const {pipe} = await serverAct(() =>
|
||||
ReactServerDOMServer.renderToPipeableStream(<App />, webpackMap),
|
||||
);
|
||||
pipe(writable);
|
||||
|
||||
let response = null;
|
||||
function getResponse() {
|
||||
if (response === null) {
|
||||
response = ReactServerDOMClient.createFromReadableStream(readable);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
function Response() {
|
||||
return getResponse();
|
||||
}
|
||||
|
||||
const errors = [];
|
||||
function onError(error, errorInfo) {
|
||||
errors.push(error, errorInfo);
|
||||
}
|
||||
const result = await serverAct(() =>
|
||||
ReactDOMStaticServer.prerenderToNodeStream(<Response />, {
|
||||
onError,
|
||||
}),
|
||||
);
|
||||
|
||||
const prelude = await new Promise((resolve, reject) => {
|
||||
let content = '';
|
||||
result.prelude.on('data', chunk => {
|
||||
content += Buffer.from(chunk).toString('utf8');
|
||||
});
|
||||
result.prelude.on('error', error => {
|
||||
reject(error);
|
||||
});
|
||||
result.prelude.on('end', () => resolve(content));
|
||||
});
|
||||
|
||||
expect(errors).toEqual([]);
|
||||
const doc = new JSDOM(prelude).window.document;
|
||||
expect(getMeaningfulChildren(doc)).toEqual(
|
||||
<html>
|
||||
<head />
|
||||
<body>
|
||||
<div>loading...</div>
|
||||
</body>
|
||||
</html>,
|
||||
);
|
||||
});
|
||||
|
||||
it('should support float methods when rendering in Fizz', async () => {
|
||||
function Component() {
|
||||
return <p>hello world</p>;
|
||||
@@ -2870,7 +2785,7 @@ describe('ReactFlightDOM', () => {
|
||||
);
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('can prerender', async () => {
|
||||
let resolveGreeting;
|
||||
const greetingPromise = new Promise(resolve => {
|
||||
@@ -3016,7 +2931,7 @@ describe('ReactFlightDOM', () => {
|
||||
});
|
||||
|
||||
// This could be a bug. Discovered while making enableAsyncDebugInfo dynamic for www.
|
||||
// @gate enableHalt || enablePostpone || (enableAsyncDebugInfo && __DEV__)
|
||||
// @gate enableHalt || (enableAsyncDebugInfo && __DEV__)
|
||||
it('will leave async iterables in an incomplete state when halting', async () => {
|
||||
let resolve;
|
||||
const wait = new Promise(r => (resolve = r));
|
||||
|
||||
+5
-111
@@ -1934,52 +1934,6 @@ describe('ReactFlightDOMBrowser', () => {
|
||||
);
|
||||
});
|
||||
|
||||
// @gate enablePostpone
|
||||
it('supports postpone in Server Components', async () => {
|
||||
function Server() {
|
||||
React.unstable_postpone('testing postpone');
|
||||
return 'Not shown';
|
||||
}
|
||||
|
||||
let postponed = null;
|
||||
|
||||
const stream = await serverAct(() =>
|
||||
ReactServerDOMServer.renderToReadableStream(
|
||||
<Suspense fallback="Loading...">
|
||||
<Server />
|
||||
</Suspense>,
|
||||
null,
|
||||
{
|
||||
onPostpone(reason) {
|
||||
postponed = reason;
|
||||
},
|
||||
},
|
||||
),
|
||||
);
|
||||
const response = ReactServerDOMClient.createFromReadableStream(stream);
|
||||
|
||||
function Client() {
|
||||
return use(response);
|
||||
}
|
||||
|
||||
const container = document.createElement('div');
|
||||
const root = ReactDOMClient.createRoot(container);
|
||||
await act(async () => {
|
||||
root.render(
|
||||
<div>
|
||||
Shell: <Client />
|
||||
</div>,
|
||||
);
|
||||
});
|
||||
// We should have reserved the shell already. Which means that the Server
|
||||
// Component should've been a lazy component.
|
||||
expect(container.innerHTML).toContain('Shell:');
|
||||
expect(container.innerHTML).toContain('Loading...');
|
||||
expect(container.innerHTML).not.toContain('Not shown');
|
||||
|
||||
expect(postponed).toBe('testing postpone');
|
||||
});
|
||||
|
||||
it('should not continue rendering after the reader cancels', async () => {
|
||||
let hasLoaded = false;
|
||||
let resolve;
|
||||
@@ -2031,66 +1985,6 @@ describe('ReactFlightDOMBrowser', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
// @gate enablePostpone
|
||||
it('postpones when abort passes a postpone signal', async () => {
|
||||
const infinitePromise = new Promise(() => {});
|
||||
function Server() {
|
||||
return infinitePromise;
|
||||
}
|
||||
|
||||
let postponed = null;
|
||||
let error = null;
|
||||
|
||||
const controller = new AbortController();
|
||||
const stream = await serverAct(() =>
|
||||
ReactServerDOMServer.renderToReadableStream(
|
||||
<Suspense fallback="Loading...">
|
||||
<Server />
|
||||
</Suspense>,
|
||||
null,
|
||||
{
|
||||
onError(x) {
|
||||
error = x;
|
||||
},
|
||||
onPostpone(reason) {
|
||||
postponed = reason;
|
||||
},
|
||||
signal: controller.signal,
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
try {
|
||||
React.unstable_postpone('testing postpone');
|
||||
} catch (reason) {
|
||||
controller.abort(reason);
|
||||
}
|
||||
|
||||
const response = ReactServerDOMClient.createFromReadableStream(stream);
|
||||
|
||||
function Client() {
|
||||
return use(response);
|
||||
}
|
||||
|
||||
const container = document.createElement('div');
|
||||
const root = ReactDOMClient.createRoot(container);
|
||||
await act(() => {
|
||||
root.render(
|
||||
<div>
|
||||
Shell: <Client />
|
||||
</div>,
|
||||
);
|
||||
});
|
||||
// We should have reserved the shell already. Which means that the Server
|
||||
// Component should've been a lazy component.
|
||||
expect(container.innerHTML).toContain('Shell:');
|
||||
expect(container.innerHTML).toContain('Loading...');
|
||||
expect(container.innerHTML).not.toContain('Not shown');
|
||||
|
||||
expect(postponed).toBe('testing postpone');
|
||||
expect(error).toBe(null);
|
||||
});
|
||||
|
||||
function passThrough(stream) {
|
||||
// Simulate more realistic network by splitting up and rejoining some chunks.
|
||||
// This lets us test that we don't accidentally rely on particular bounds of the chunks.
|
||||
@@ -2495,7 +2389,7 @@ describe('ReactFlightDOMBrowser', () => {
|
||||
expect(errors).toEqual([reason]);
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('can prerender', async () => {
|
||||
let resolveGreeting;
|
||||
const greetingPromise = new Promise(resolve => {
|
||||
@@ -3009,9 +2903,9 @@ describe('ReactFlightDOMBrowser', () => {
|
||||
[
|
||||
"",
|
||||
"/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js",
|
||||
2935,
|
||||
2829,
|
||||
27,
|
||||
2929,
|
||||
2823,
|
||||
34,
|
||||
],
|
||||
[
|
||||
@@ -3025,9 +2919,9 @@ describe('ReactFlightDOMBrowser', () => {
|
||||
[
|
||||
"Object.<anonymous>",
|
||||
"/packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMBrowser-test.js",
|
||||
2929,
|
||||
2823,
|
||||
18,
|
||||
2916,
|
||||
2810,
|
||||
89,
|
||||
],
|
||||
],
|
||||
|
||||
@@ -1365,7 +1365,7 @@ describe('ReactFlightDOMEdge', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('can prerender', async () => {
|
||||
let resolveGreeting;
|
||||
const greetingPromise = new Promise(resolve => {
|
||||
@@ -1547,7 +1547,7 @@ describe('ReactFlightDOMEdge', () => {
|
||||
expect(error.message).toBe('Connection closed.');
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('should be able to handle a rejected promise in prerender', async () => {
|
||||
const expectedError = new Error('Bam!');
|
||||
const errors = [];
|
||||
@@ -1586,7 +1586,7 @@ describe('ReactFlightDOMEdge', () => {
|
||||
expect(error.message).toBe(expectedMessage);
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('should be able to handle an erroring async iterable in prerender', async () => {
|
||||
const expectedError = new Error('Bam!');
|
||||
const errors = [];
|
||||
@@ -1633,7 +1633,7 @@ describe('ReactFlightDOMEdge', () => {
|
||||
expect(error.message).toBe(expectedMessage);
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('should be able to handle an erroring readable stream in prerender', async () => {
|
||||
const expectedError = new Error('Bam!');
|
||||
const errors = [];
|
||||
@@ -1681,7 +1681,7 @@ describe('ReactFlightDOMEdge', () => {
|
||||
expect(error.message).toBe(expectedMessage);
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('can prerender an async iterable', async () => {
|
||||
const errors = [];
|
||||
|
||||
@@ -1725,7 +1725,7 @@ describe('ReactFlightDOMEdge', () => {
|
||||
expect(text).toBe('hello world');
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('can prerender a readable stream', async () => {
|
||||
const errors = [];
|
||||
|
||||
@@ -1759,7 +1759,7 @@ describe('ReactFlightDOMEdge', () => {
|
||||
expect(result).toBe('hello world');
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('does not return a prerender prelude early when an error is emitted and there are still pending tasks', async () => {
|
||||
let rejectPromise;
|
||||
const rejectingPromise = new Promise(
|
||||
|
||||
@@ -500,7 +500,7 @@ describe('ReactFlightDOMNode', () => {
|
||||
expect(errors).toEqual([reason]);
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
it('can prerender', async () => {
|
||||
let resolveGreeting;
|
||||
const greetingPromise = new Promise(resolve => {
|
||||
@@ -920,7 +920,7 @@ describe('ReactFlightDOMNode', () => {
|
||||
}
|
||||
});
|
||||
|
||||
// @gate enableHalt || enablePostpone
|
||||
// @gate enableHalt
|
||||
// @gate enableHalt
|
||||
it('can handle an empty prelude when prerendering', async () => {
|
||||
function App() {
|
||||
|
||||
@@ -64,7 +64,6 @@ type Options = {
|
||||
signal?: AbortSignal,
|
||||
temporaryReferences?: TemporaryReferenceSet,
|
||||
onError?: (error: mixed) => void,
|
||||
onPostpone?: (reason: string) => void,
|
||||
};
|
||||
|
||||
function startReadingFromDebugChannelReadableStream(
|
||||
@@ -126,7 +125,6 @@ function renderToReadableStream(
|
||||
webpackMap,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
@@ -215,7 +213,6 @@ function prerender(
|
||||
onFatalError,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
|
||||
@@ -69,7 +69,6 @@ type Options = {
|
||||
signal?: AbortSignal,
|
||||
temporaryReferences?: TemporaryReferenceSet,
|
||||
onError?: (error: mixed) => void,
|
||||
onPostpone?: (reason: string) => void,
|
||||
};
|
||||
|
||||
function startReadingFromDebugChannelReadableStream(
|
||||
@@ -131,7 +130,6 @@ function renderToReadableStream(
|
||||
webpackMap,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
@@ -220,7 +218,6 @@ function prerender(
|
||||
onFatalError,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
|
||||
@@ -150,7 +150,6 @@ type Options = {
|
||||
environmentName?: string | (() => string),
|
||||
filterStackFrame?: (url: string, functionName: string) => boolean,
|
||||
onError?: (error: mixed) => void,
|
||||
onPostpone?: (reason: string) => void,
|
||||
identifierPrefix?: string,
|
||||
temporaryReferences?: TemporaryReferenceSet,
|
||||
};
|
||||
@@ -189,7 +188,6 @@ function renderToPipeableStream(
|
||||
webpackMap,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
@@ -348,7 +346,6 @@ function renderToReadableStream(
|
||||
webpackMap,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
@@ -429,7 +426,6 @@ type PrerenderOptions = {
|
||||
environmentName?: string | (() => string),
|
||||
filterStackFrame?: (url: string, functionName: string) => boolean,
|
||||
onError?: (error: mixed) => void,
|
||||
onPostpone?: (reason: string) => void,
|
||||
identifierPrefix?: string,
|
||||
temporaryReferences?: TemporaryReferenceSet,
|
||||
signal?: AbortSignal,
|
||||
@@ -463,7 +459,6 @@ function prerenderToNodeStream(
|
||||
onFatalError,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
@@ -527,7 +522,6 @@ function prerender(
|
||||
onFatalError,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
|
||||
@@ -43,7 +43,6 @@ function render(
|
||||
clientManifest,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
@@ -214,7 +213,6 @@ function prerender(
|
||||
onFatalError,
|
||||
options ? options.onError : undefined,
|
||||
options ? options.identifierPrefix : undefined,
|
||||
options ? options.onPostpone : undefined,
|
||||
options ? options.temporaryReferences : undefined,
|
||||
__DEV__ && options ? options.environmentName : undefined,
|
||||
__DEV__ && options ? options.filterStackFrame : undefined,
|
||||
|
||||
+36
-322
@@ -168,7 +168,6 @@ import {
|
||||
REACT_CONTEXT_TYPE,
|
||||
REACT_CONSUMER_TYPE,
|
||||
REACT_SCOPE_TYPE,
|
||||
REACT_POSTPONE_TYPE,
|
||||
REACT_VIEW_TRANSITION_TYPE,
|
||||
REACT_ACTIVITY_TYPE,
|
||||
} from 'shared/ReactSymbols';
|
||||
@@ -177,7 +176,6 @@ import {
|
||||
disableLegacyContext,
|
||||
disableLegacyContextForFunctionComponents,
|
||||
enableScopeAPI,
|
||||
enablePostpone,
|
||||
enableHalt,
|
||||
enableAsyncIterableChildren,
|
||||
enableViewTransition,
|
||||
@@ -190,7 +188,6 @@ import noop from 'shared/noop';
|
||||
import getComponentNameFromType from 'shared/getComponentNameFromType';
|
||||
import isArray from 'shared/isArray';
|
||||
import {SuspenseException, getSuspendedThenable} from './ReactFizzThenable';
|
||||
import type {Postpone} from 'react/src/ReactPostpone';
|
||||
|
||||
// Linked list representing the identity of a component given the component/tag name and key.
|
||||
// The name might be minified but we assume that it's going to be the same generated name. Typically
|
||||
@@ -391,9 +388,6 @@ export opaque type Request = {
|
||||
// emit a different response to the stream instead.
|
||||
onShellError: (error: mixed) => void,
|
||||
onFatalError: (error: mixed) => void,
|
||||
// onPostpone is called when postpone() is called anywhere in the tree, which will defer
|
||||
// rendering - e.g. to the client. This is considered intentional and not an error.
|
||||
onPostpone: (reason: string, postponeInfo: ThrownInfo) => void,
|
||||
// Form state that was the result of an MPA submission, if it was provided.
|
||||
formState: null | ReactFormState<any, any>,
|
||||
// DEV-only, warning dedupe
|
||||
@@ -496,7 +490,6 @@ function RequestInstance(
|
||||
onShellReady: void | (() => void),
|
||||
onShellError: void | ((error: mixed) => void),
|
||||
onFatalError: void | ((error: mixed) => void),
|
||||
onPostpone: void | ((reason: string, postponeInfo: PostponeInfo) => void),
|
||||
formState: void | null | ReactFormState<any, any>,
|
||||
) {
|
||||
const pingedTasks: Array<Task> = [];
|
||||
@@ -525,7 +518,6 @@ function RequestInstance(
|
||||
this.partialBoundaries = ([]: Array<SuspenseBoundary>);
|
||||
this.trackedPostpones = null;
|
||||
this.onError = onError === undefined ? defaultErrorHandler : onError;
|
||||
this.onPostpone = onPostpone === undefined ? noop : onPostpone;
|
||||
this.onAllReady = onAllReady === undefined ? noop : onAllReady;
|
||||
this.onShellReady = onShellReady === undefined ? noop : onShellReady;
|
||||
this.onShellError = onShellError === undefined ? noop : onShellError;
|
||||
@@ -547,7 +539,6 @@ export function createRequest(
|
||||
onShellReady: void | (() => void),
|
||||
onShellError: void | ((error: mixed) => void),
|
||||
onFatalError: void | ((error: mixed) => void),
|
||||
onPostpone: void | ((reason: string, postponeInfo: PostponeInfo) => void),
|
||||
formState: void | null | ReactFormState<any, any>,
|
||||
): Request {
|
||||
if (__DEV__) {
|
||||
@@ -565,7 +556,6 @@ export function createRequest(
|
||||
onShellReady,
|
||||
onShellError,
|
||||
onFatalError,
|
||||
onPostpone,
|
||||
formState,
|
||||
);
|
||||
|
||||
@@ -616,7 +606,6 @@ export function createPrerenderRequest(
|
||||
onShellReady: void | (() => void),
|
||||
onShellError: void | ((error: mixed) => void),
|
||||
onFatalError: void | ((error: mixed) => void),
|
||||
onPostpone: void | ((reason: string, postponeInfo: PostponeInfo) => void),
|
||||
): Request {
|
||||
const request = createRequest(
|
||||
children,
|
||||
@@ -629,7 +618,6 @@ export function createPrerenderRequest(
|
||||
onShellReady,
|
||||
onShellError,
|
||||
onFatalError,
|
||||
onPostpone,
|
||||
undefined,
|
||||
);
|
||||
// Start tracking postponed holes during this render.
|
||||
@@ -650,7 +638,6 @@ export function resumeRequest(
|
||||
onShellReady: void | (() => void),
|
||||
onShellError: void | ((error: mixed) => void),
|
||||
onFatalError: void | ((error: mixed) => void),
|
||||
onPostpone: void | ((reason: string, postponeInfo: PostponeInfo) => void),
|
||||
): Request {
|
||||
if (__DEV__) {
|
||||
resetOwnerStackLimit();
|
||||
@@ -667,7 +654,6 @@ export function resumeRequest(
|
||||
onShellReady,
|
||||
onShellError,
|
||||
onFatalError,
|
||||
onPostpone,
|
||||
null,
|
||||
);
|
||||
request.nextSegmentId = postponedState.nextSegmentId;
|
||||
@@ -746,7 +732,6 @@ export function resumeAndPrerenderRequest(
|
||||
onShellReady: void | (() => void),
|
||||
onShellError: void | ((error: mixed) => void),
|
||||
onFatalError: void | ((error: mixed) => void),
|
||||
onPostpone: void | ((reason: string, postponeInfo: PostponeInfo) => void),
|
||||
): Request {
|
||||
const request = resumeRequest(
|
||||
children,
|
||||
@@ -757,7 +742,6 @@ export function resumeAndPrerenderRequest(
|
||||
onShellReady,
|
||||
onShellError,
|
||||
onFatalError,
|
||||
onPostpone,
|
||||
);
|
||||
// Start tracking postponed holes during this render.
|
||||
request.trackedPostpones = {
|
||||
@@ -1137,7 +1121,6 @@ type ThrownInfo = {
|
||||
componentStack?: string,
|
||||
};
|
||||
export type ErrorInfo = ThrownInfo;
|
||||
export type PostponeInfo = ThrownInfo;
|
||||
|
||||
function getThrownInfo(node: null | ComponentStackNode): ThrownInfo {
|
||||
const errorInfo: ThrownInfo = {};
|
||||
@@ -1191,22 +1174,6 @@ function encodeErrorForBoundary(
|
||||
}
|
||||
}
|
||||
|
||||
function logPostpone(
|
||||
request: Request,
|
||||
reason: string,
|
||||
postponeInfo: ThrownInfo,
|
||||
debugTask: null | ConsoleTask,
|
||||
): void {
|
||||
// If this callback errors, we intentionally let that error bubble up to become a fatal error
|
||||
// so that someone fixes the error reporting instead of hiding it.
|
||||
const onPostpone = request.onPostpone;
|
||||
if (__DEV__ && debugTask) {
|
||||
debugTask.run(onPostpone.bind(null, reason, postponeInfo));
|
||||
} else {
|
||||
onPostpone(reason, postponeInfo);
|
||||
}
|
||||
}
|
||||
|
||||
function logRecoverableError(
|
||||
request: Request,
|
||||
error: any,
|
||||
@@ -1525,30 +1492,12 @@ function renderSuspenseBoundary(
|
||||
}
|
||||
|
||||
const thrownInfo = getThrownInfo(task.componentStack);
|
||||
let errorDigest;
|
||||
if (
|
||||
enablePostpone &&
|
||||
typeof error === 'object' &&
|
||||
error !== null &&
|
||||
error.$$typeof === REACT_POSTPONE_TYPE
|
||||
) {
|
||||
const postponeInstance: Postpone = (error: any);
|
||||
logPostpone(
|
||||
request,
|
||||
postponeInstance.message,
|
||||
thrownInfo,
|
||||
__DEV__ ? task.debugTask : null,
|
||||
);
|
||||
// TODO: Figure out a better signal than a magic digest value.
|
||||
errorDigest = 'POSTPONE';
|
||||
} else {
|
||||
errorDigest = logRecoverableError(
|
||||
request,
|
||||
error,
|
||||
thrownInfo,
|
||||
__DEV__ ? task.debugTask : null,
|
||||
);
|
||||
}
|
||||
const errorDigest = logRecoverableError(
|
||||
request,
|
||||
error,
|
||||
thrownInfo,
|
||||
__DEV__ ? task.debugTask : null,
|
||||
);
|
||||
encodeErrorForBoundary(
|
||||
newBoundary,
|
||||
errorDigest,
|
||||
@@ -1696,30 +1645,12 @@ function replaySuspenseBoundary(
|
||||
} catch (error: mixed) {
|
||||
resumedBoundary.status = CLIENT_RENDERED;
|
||||
const thrownInfo = getThrownInfo(task.componentStack);
|
||||
let errorDigest;
|
||||
if (
|
||||
enablePostpone &&
|
||||
typeof error === 'object' &&
|
||||
error !== null &&
|
||||
error.$$typeof === REACT_POSTPONE_TYPE
|
||||
) {
|
||||
const postponeInstance: Postpone = (error: any);
|
||||
logPostpone(
|
||||
request,
|
||||
postponeInstance.message,
|
||||
thrownInfo,
|
||||
__DEV__ ? task.debugTask : null,
|
||||
);
|
||||
// TODO: Figure out a better signal than a magic digest value.
|
||||
errorDigest = 'POSTPONE';
|
||||
} else {
|
||||
errorDigest = logRecoverableError(
|
||||
request,
|
||||
error,
|
||||
thrownInfo,
|
||||
__DEV__ ? task.debugTask : null,
|
||||
);
|
||||
}
|
||||
const errorDigest = logRecoverableError(
|
||||
request,
|
||||
error,
|
||||
thrownInfo,
|
||||
__DEV__ ? task.debugTask : null,
|
||||
);
|
||||
encodeErrorForBoundary(
|
||||
resumedBoundary,
|
||||
errorDigest,
|
||||
@@ -4025,32 +3956,6 @@ function untrackBoundary(request: Request, boundary: SuspenseBoundary) {
|
||||
// we don't replay the path to it.
|
||||
}
|
||||
|
||||
function injectPostponedHole(
|
||||
request: Request,
|
||||
task: RenderTask,
|
||||
reason: string,
|
||||
thrownInfo: ThrownInfo,
|
||||
): Segment {
|
||||
logPostpone(request, reason, thrownInfo, __DEV__ ? task.debugTask : null);
|
||||
// Something suspended, we'll need to create a new segment and resolve it later.
|
||||
const segment = task.blockedSegment;
|
||||
const insertionIndex = segment.chunks.length;
|
||||
const newSegment = createPendingSegment(
|
||||
request,
|
||||
insertionIndex,
|
||||
null,
|
||||
task.formatContext,
|
||||
// Adopt the parent segment's leading text embed
|
||||
segment.lastPushedText,
|
||||
// Assume we are text embedded at the trailing edge
|
||||
true,
|
||||
);
|
||||
segment.children.push(newSegment);
|
||||
// Reset lastPushedText for current Segment since the new Segment "consumed" it
|
||||
segment.lastPushedText = false;
|
||||
return newSegment;
|
||||
}
|
||||
|
||||
function spawnNewSuspendedReplayTask(
|
||||
request: Request,
|
||||
task: ReplayTask,
|
||||
@@ -4297,45 +4202,6 @@ function renderNode(
|
||||
switchContext(previousContext);
|
||||
return;
|
||||
}
|
||||
if (
|
||||
enablePostpone &&
|
||||
x.$$typeof === REACT_POSTPONE_TYPE &&
|
||||
request.trackedPostpones !== null &&
|
||||
task.blockedBoundary !== null // bubble if we're postponing in the shell
|
||||
) {
|
||||
// If we're tracking postpones, we inject a hole here and continue rendering
|
||||
// sibling. Similar to suspending. If we're not tracking, we treat it more like
|
||||
// an error. Notably this doesn't spawn a new task since nothing will fill it
|
||||
// in during this prerender.
|
||||
const trackedPostpones = request.trackedPostpones;
|
||||
|
||||
const postponeInstance: Postpone = (x: any);
|
||||
const thrownInfo = getThrownInfo(task.componentStack);
|
||||
const postponedSegment = injectPostponedHole(
|
||||
request,
|
||||
((task: any): RenderTask), // We don't use ReplayTasks in prerenders.
|
||||
postponeInstance.message,
|
||||
thrownInfo,
|
||||
);
|
||||
trackPostpone(request, trackedPostpones, task, postponedSegment);
|
||||
|
||||
// Restore the context. We assume that this will be restored by the inner
|
||||
// functions in case nothing throws so we don't use "finally" here.
|
||||
task.formatContext = previousFormatContext;
|
||||
if (!disableLegacyContext) {
|
||||
task.legacyContext = previousLegacyContext;
|
||||
}
|
||||
task.context = previousContext;
|
||||
task.keyPath = previousKeyPath;
|
||||
task.treeContext = previousTreeContext;
|
||||
task.componentStack = previousComponentStack;
|
||||
if (__DEV__) {
|
||||
task.debugTask = previousDebugTask;
|
||||
}
|
||||
// Restore all active ReactContexts to what they were before.
|
||||
switchContext(previousContext);
|
||||
return;
|
||||
}
|
||||
if (x.message === 'Maximum call stack size exceeded') {
|
||||
// This was a stack overflow. We do a lot of recursion in React by default for
|
||||
// performance but it can lead to stack overflows in extremely deep trees.
|
||||
@@ -4411,20 +4277,7 @@ function erroredReplay(
|
||||
// that doesn't error the parent Suspense boundary.
|
||||
// This might be a bit strange that the error in a parent gets thrown at a child.
|
||||
// We log it only once and reuse the digest.
|
||||
let errorDigest;
|
||||
if (
|
||||
enablePostpone &&
|
||||
typeof error === 'object' &&
|
||||
error !== null &&
|
||||
error.$$typeof === REACT_POSTPONE_TYPE
|
||||
) {
|
||||
const postponeInstance: Postpone = (error: any);
|
||||
logPostpone(request, postponeInstance.message, errorInfo, debugTask);
|
||||
// TODO: Figure out a better signal than a magic digest value.
|
||||
errorDigest = 'POSTPONE';
|
||||
} else {
|
||||
errorDigest = logRecoverableError(request, error, errorInfo, debugTask);
|
||||
}
|
||||
const errorDigest = logRecoverableError(request, error, errorInfo, debugTask);
|
||||
abortRemainingReplayNodes(
|
||||
request,
|
||||
boundary,
|
||||
@@ -4454,23 +4307,10 @@ function erroredTask(
|
||||
request.allPendingTasks--;
|
||||
|
||||
// Report the error to a global handler.
|
||||
let errorDigest;
|
||||
// We don't handle halts here because we only halt when prerendering and
|
||||
// when prerendering we should be finishing tasks not erroring them when
|
||||
// they halt or postpone
|
||||
if (
|
||||
enablePostpone &&
|
||||
typeof error === 'object' &&
|
||||
error !== null &&
|
||||
error.$$typeof === REACT_POSTPONE_TYPE
|
||||
) {
|
||||
const postponeInstance: Postpone = (error: any);
|
||||
logPostpone(request, postponeInstance.message, errorInfo, debugTask);
|
||||
// TODO: Figure out a better signal than a magic digest value.
|
||||
errorDigest = 'POSTPONE';
|
||||
} else {
|
||||
errorDigest = logRecoverableError(request, error, errorInfo, debugTask);
|
||||
}
|
||||
const errorDigest = logRecoverableError(request, error, errorInfo, debugTask);
|
||||
if (boundary === null) {
|
||||
fatalError(request, error, errorInfo, debugTask);
|
||||
} else {
|
||||
@@ -4691,34 +4531,6 @@ function abortTask(task: Task, request: Request, error: mixed): void {
|
||||
// We didn't complete the root so we have nothing to show. We can close
|
||||
// the request;
|
||||
if (
|
||||
enablePostpone &&
|
||||
typeof error === 'object' &&
|
||||
error !== null &&
|
||||
error.$$typeof === REACT_POSTPONE_TYPE
|
||||
) {
|
||||
const postponeInstance: Postpone = (error: any);
|
||||
const trackedPostpones = request.trackedPostpones;
|
||||
|
||||
if (trackedPostpones !== null && segment !== null) {
|
||||
// We are prerendering. We don't want to fatal when the shell postpones
|
||||
// we just need to mark it as postponed.
|
||||
logPostpone(
|
||||
request,
|
||||
postponeInstance.message,
|
||||
errorInfo,
|
||||
task.debugTask,
|
||||
);
|
||||
trackPostpone(request, trackedPostpones, task, segment);
|
||||
finishedTask(request, null, task.row, segment);
|
||||
} else {
|
||||
const fatal = new Error(
|
||||
'The render was aborted with postpone when the shell is incomplete. Reason: ' +
|
||||
postponeInstance.message,
|
||||
);
|
||||
logRecoverableError(request, fatal, errorInfo, task.debugTask);
|
||||
fatalError(request, fatal, errorInfo, task.debugTask);
|
||||
}
|
||||
} else if (
|
||||
enableHalt &&
|
||||
request.trackedPostpones !== null &&
|
||||
segment !== null
|
||||
@@ -4740,25 +4552,12 @@ function abortTask(task: Task, request: Request, error: mixed): void {
|
||||
// the ReplaySet.
|
||||
replay.pendingTasks--;
|
||||
if (replay.pendingTasks === 0 && replay.nodes.length > 0) {
|
||||
let errorDigest;
|
||||
if (
|
||||
enablePostpone &&
|
||||
typeof error === 'object' &&
|
||||
error !== null &&
|
||||
error.$$typeof === REACT_POSTPONE_TYPE
|
||||
) {
|
||||
const postponeInstance: Postpone = (error: any);
|
||||
logPostpone(
|
||||
request,
|
||||
postponeInstance.message,
|
||||
errorInfo,
|
||||
task.debugTask,
|
||||
);
|
||||
// TODO: Figure out a better signal than a magic digest value.
|
||||
errorDigest = 'POSTPONE';
|
||||
} else {
|
||||
errorDigest = logRecoverableError(request, error, errorInfo, null);
|
||||
}
|
||||
const errorDigest = logRecoverableError(
|
||||
request,
|
||||
error,
|
||||
errorInfo,
|
||||
null,
|
||||
);
|
||||
abortRemainingReplayNodes(
|
||||
request,
|
||||
null,
|
||||
@@ -4783,25 +4582,9 @@ function abortTask(task: Task, request: Request, error: mixed): void {
|
||||
if (boundary.status !== CLIENT_RENDERED) {
|
||||
if (enableHalt) {
|
||||
if (trackedPostpones !== null && segment !== null) {
|
||||
// We are aborting a prerender
|
||||
if (
|
||||
enablePostpone &&
|
||||
typeof error === 'object' &&
|
||||
error !== null &&
|
||||
error.$$typeof === REACT_POSTPONE_TYPE
|
||||
) {
|
||||
const postponeInstance: Postpone = (error: any);
|
||||
logPostpone(
|
||||
request,
|
||||
postponeInstance.message,
|
||||
errorInfo,
|
||||
task.debugTask,
|
||||
);
|
||||
} else {
|
||||
// We are aborting a prerender and must halt this boundary.
|
||||
// We treat this like other postpones during prerendering
|
||||
logRecoverableError(request, error, errorInfo, task.debugTask);
|
||||
}
|
||||
// We are aborting a prerender and must halt this boundary.
|
||||
// We treat this like other postpones during prerendering
|
||||
logRecoverableError(request, error, errorInfo, task.debugTask);
|
||||
trackPostpone(request, trackedPostpones, task, segment);
|
||||
// If this boundary was still pending then we haven't already cancelled its fallbacks.
|
||||
// We'll need to abort the fallbacks, which will also error that parent boundary.
|
||||
@@ -4815,42 +4598,12 @@ function abortTask(task: Task, request: Request, error: mixed): void {
|
||||
boundary.status = CLIENT_RENDERED;
|
||||
// We are aborting a render or resume which should put boundaries
|
||||
// into an explicitly client rendered state
|
||||
let errorDigest;
|
||||
if (
|
||||
enablePostpone &&
|
||||
typeof error === 'object' &&
|
||||
error !== null &&
|
||||
error.$$typeof === REACT_POSTPONE_TYPE
|
||||
) {
|
||||
const postponeInstance: Postpone = (error: any);
|
||||
logPostpone(
|
||||
request,
|
||||
postponeInstance.message,
|
||||
errorInfo,
|
||||
task.debugTask,
|
||||
);
|
||||
if (request.trackedPostpones !== null && segment !== null) {
|
||||
trackPostpone(request, request.trackedPostpones, task, segment);
|
||||
finishedTask(request, task.blockedBoundary, task.row, segment);
|
||||
|
||||
// If this boundary was still pending then we haven't already cancelled its fallbacks.
|
||||
// We'll need to abort the fallbacks, which will also error that parent boundary.
|
||||
boundary.fallbackAbortableTasks.forEach(fallbackTask =>
|
||||
abortTask(fallbackTask, request, error),
|
||||
);
|
||||
boundary.fallbackAbortableTasks.clear();
|
||||
return;
|
||||
}
|
||||
// TODO: Figure out a better signal than a magic digest value.
|
||||
errorDigest = 'POSTPONE';
|
||||
} else {
|
||||
errorDigest = logRecoverableError(
|
||||
request,
|
||||
error,
|
||||
errorInfo,
|
||||
task.debugTask,
|
||||
);
|
||||
}
|
||||
const errorDigest = logRecoverableError(
|
||||
request,
|
||||
error,
|
||||
errorInfo,
|
||||
task.debugTask,
|
||||
);
|
||||
boundary.status = CLIENT_RENDERED;
|
||||
encodeErrorForBoundary(boundary, errorDigest, error, errorInfo, true);
|
||||
|
||||
@@ -5254,27 +5007,12 @@ function retryRenderTask(
|
||||
const thrownInfo = getThrownInfo(task.componentStack);
|
||||
task.abortSet.delete(task);
|
||||
|
||||
if (
|
||||
enablePostpone &&
|
||||
typeof x === 'object' &&
|
||||
x !== null &&
|
||||
x.$$typeof === REACT_POSTPONE_TYPE
|
||||
) {
|
||||
const postponeInstance: Postpone = (x: any);
|
||||
logPostpone(
|
||||
request,
|
||||
postponeInstance.message,
|
||||
thrownInfo,
|
||||
__DEV__ ? task.debugTask : null,
|
||||
);
|
||||
} else {
|
||||
logRecoverableError(
|
||||
request,
|
||||
x,
|
||||
thrownInfo,
|
||||
__DEV__ ? task.debugTask : null,
|
||||
);
|
||||
}
|
||||
logRecoverableError(
|
||||
request,
|
||||
x,
|
||||
thrownInfo,
|
||||
__DEV__ ? task.debugTask : null,
|
||||
);
|
||||
|
||||
trackPostpone(request, trackedPostpones, task, segment);
|
||||
finishedTask(request, task.blockedBoundary, task.row, segment);
|
||||
@@ -5294,28 +5032,6 @@ function retryRenderTask(
|
||||
// We've asserted that x is a thenable above
|
||||
(x: any).then(ping, ping);
|
||||
return;
|
||||
} else if (
|
||||
enablePostpone &&
|
||||
request.trackedPostpones !== null &&
|
||||
x.$$typeof === REACT_POSTPONE_TYPE
|
||||
) {
|
||||
// If we're tracking postpones, we mark this segment as postponed and finish
|
||||
// the task without filling it in. If we're not tracking, we treat it more like
|
||||
// an error.
|
||||
const trackedPostpones = request.trackedPostpones;
|
||||
task.abortSet.delete(task);
|
||||
const postponeInstance: Postpone = (x: any);
|
||||
|
||||
const postponeInfo = getThrownInfo(task.componentStack);
|
||||
logPostpone(
|
||||
request,
|
||||
postponeInstance.message,
|
||||
postponeInfo,
|
||||
__DEV__ ? task.debugTask : null,
|
||||
);
|
||||
trackPostpone(request, trackedPostpones, task, segment);
|
||||
finishedTask(request, task.blockedBoundary, task.row, segment);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6166,9 +5882,7 @@ function flushCompletedQueues(
|
||||
request.flushScheduled = false;
|
||||
// We write the trailing tags but only if don't have any data to resume.
|
||||
// If we need to resume we'll write the postamble in the resume instead.
|
||||
if (!enablePostpone || request.trackedPostpones === null) {
|
||||
writePostamble(destination, request.resumableState);
|
||||
}
|
||||
writePostamble(destination, request.resumableState);
|
||||
completeWriting(destination);
|
||||
flushBuffered(destination);
|
||||
if (__DEV__) {
|
||||
|
||||
+18
-133
@@ -9,12 +9,9 @@
|
||||
|
||||
import type {Chunk, BinaryChunk, Destination} from './ReactServerStreamConfig';
|
||||
|
||||
import type {Postpone} from 'react/src/ReactPostpone';
|
||||
|
||||
import type {TemporaryReferenceSet} from './ReactFlightServerTemporaryReferences';
|
||||
|
||||
import {
|
||||
enablePostpone,
|
||||
enableHalt,
|
||||
enableTaint,
|
||||
enableProfilerTimer,
|
||||
@@ -138,7 +135,6 @@ import {
|
||||
REACT_FRAGMENT_TYPE,
|
||||
REACT_LAZY_TYPE,
|
||||
REACT_MEMO_TYPE,
|
||||
REACT_POSTPONE_TYPE,
|
||||
ASYNC_ITERATOR,
|
||||
} from 'shared/ReactSymbols';
|
||||
|
||||
@@ -593,7 +589,6 @@ export type Request = {
|
||||
identifierCount: number,
|
||||
taintCleanupQueue: Array<string | bigint>,
|
||||
onError: (error: mixed) => ?string,
|
||||
onPostpone: (reason: string) => void,
|
||||
onAllReady: () => void,
|
||||
onFatalError: mixed => void,
|
||||
// Profiling-only
|
||||
@@ -649,15 +644,12 @@ function defaultErrorHandler(error: mixed) {
|
||||
// Don't transform to our wrapper
|
||||
}
|
||||
|
||||
const defaultPostponeHandler: (reason: string) => void = noop;
|
||||
|
||||
function RequestInstance(
|
||||
this: $FlowFixMe,
|
||||
type: 20 | 21,
|
||||
model: ReactClientValue,
|
||||
bundlerConfig: ClientManifest,
|
||||
onError: void | ((error: mixed) => ?string),
|
||||
onPostpone: void | ((reason: string) => void),
|
||||
onAllReady: () => void,
|
||||
onFatalError: (error: mixed) => void,
|
||||
identifierPrefix?: string,
|
||||
@@ -715,8 +707,6 @@ function RequestInstance(
|
||||
this.identifierCount = 1;
|
||||
this.taintCleanupQueue = cleanupQueue;
|
||||
this.onError = onError === undefined ? defaultErrorHandler : onError;
|
||||
this.onPostpone =
|
||||
onPostpone === undefined ? defaultPostponeHandler : onPostpone;
|
||||
this.onAllReady = onAllReady;
|
||||
this.onFatalError = onFatalError;
|
||||
|
||||
@@ -787,7 +777,6 @@ export function createRequest(
|
||||
bundlerConfig: ClientManifest,
|
||||
onError: void | ((error: mixed) => ?string),
|
||||
identifierPrefix: void | string,
|
||||
onPostpone: void | ((reason: string) => void),
|
||||
temporaryReferences: void | TemporaryReferenceSet,
|
||||
environmentName: void | string | (() => string), // DEV-only
|
||||
filterStackFrame: void | ((url: string, functionName: string) => boolean), // DEV-only
|
||||
@@ -803,7 +792,6 @@ export function createRequest(
|
||||
model,
|
||||
bundlerConfig,
|
||||
onError,
|
||||
onPostpone,
|
||||
noop,
|
||||
noop,
|
||||
identifierPrefix,
|
||||
@@ -821,7 +809,6 @@ export function createPrerenderRequest(
|
||||
onFatalError: () => void,
|
||||
onError: void | ((error: mixed) => ?string),
|
||||
identifierPrefix: void | string,
|
||||
onPostpone: void | ((reason: string) => void),
|
||||
temporaryReferences: void | TemporaryReferenceSet,
|
||||
environmentName: void | string | (() => string), // DEV-only
|
||||
filterStackFrame: void | ((url: string, functionName: string) => boolean), // DEV-only
|
||||
@@ -837,7 +824,6 @@ export function createPrerenderRequest(
|
||||
model,
|
||||
bundlerConfig,
|
||||
onError,
|
||||
onPostpone,
|
||||
onAllReady,
|
||||
onFatalError,
|
||||
identifierPrefix,
|
||||
@@ -3392,28 +3378,15 @@ function renderModel(
|
||||
// Something errored. We'll still send everything we have up until this point.
|
||||
request.pendingChunks++;
|
||||
const errorId = request.nextChunkId++;
|
||||
if (
|
||||
enablePostpone &&
|
||||
typeof x === 'object' &&
|
||||
x !== null &&
|
||||
x.$$typeof === REACT_POSTPONE_TYPE
|
||||
) {
|
||||
// Something postponed. We'll still send everything we have up until this point.
|
||||
// We'll replace this element with a lazy reference that postpones on the client.
|
||||
const postponeInstance: Postpone = (x: any);
|
||||
logPostpone(request, postponeInstance.message, task);
|
||||
emitPostponeChunk(request, errorId, postponeInstance);
|
||||
} else {
|
||||
const digest = logRecoverableError(request, x, task);
|
||||
emitErrorChunk(
|
||||
request,
|
||||
errorId,
|
||||
digest,
|
||||
x,
|
||||
false,
|
||||
__DEV__ ? task.debugOwner : null,
|
||||
);
|
||||
}
|
||||
const digest = logRecoverableError(request, x, task);
|
||||
emitErrorChunk(
|
||||
request,
|
||||
errorId,
|
||||
digest,
|
||||
x,
|
||||
false,
|
||||
__DEV__ ? task.debugOwner : null,
|
||||
);
|
||||
if (wasReactNode) {
|
||||
// We'll replace this element with a lazy reference that throws on the client
|
||||
// once it gets rendered.
|
||||
@@ -4030,41 +4003,6 @@ function renderModelDestructive(
|
||||
);
|
||||
}
|
||||
|
||||
function logPostpone(
|
||||
request: Request,
|
||||
reason: string,
|
||||
task: Task | null, // DEV-only
|
||||
): void {
|
||||
const prevRequest = currentRequest;
|
||||
// We clear the request context so that console.logs inside the callback doesn't
|
||||
// get forwarded to the client.
|
||||
currentRequest = null;
|
||||
try {
|
||||
const onPostpone = request.onPostpone;
|
||||
if (__DEV__ && task !== null) {
|
||||
if (supportsRequestStorage) {
|
||||
requestStorage.run(
|
||||
undefined,
|
||||
callWithDebugContextInDEV,
|
||||
request,
|
||||
task,
|
||||
onPostpone,
|
||||
reason,
|
||||
);
|
||||
} else {
|
||||
callWithDebugContextInDEV(request, task, onPostpone, reason);
|
||||
}
|
||||
} else if (supportsRequestStorage) {
|
||||
// Exit the request context while running callbacks.
|
||||
requestStorage.run(undefined, onPostpone, reason);
|
||||
} else {
|
||||
onPostpone(reason);
|
||||
}
|
||||
} finally {
|
||||
currentRequest = prevRequest;
|
||||
}
|
||||
}
|
||||
|
||||
function logRecoverableError(
|
||||
request: Request,
|
||||
error: mixed,
|
||||
@@ -4131,32 +4069,6 @@ function fatalError(request: Request, error: mixed): void {
|
||||
request.cacheController.abort(abortReason);
|
||||
}
|
||||
|
||||
function emitPostponeChunk(
|
||||
request: Request,
|
||||
id: number,
|
||||
postponeInstance: Postpone,
|
||||
): void {
|
||||
let row;
|
||||
if (__DEV__) {
|
||||
let reason = '';
|
||||
let stack: ReactStackTrace;
|
||||
const env = request.environmentName();
|
||||
try {
|
||||
// eslint-disable-next-line react-internal/safe-string-coercion
|
||||
reason = String(postponeInstance.message);
|
||||
stack = filterStackTrace(request, parseStackTrace(postponeInstance, 0));
|
||||
} catch (x) {
|
||||
stack = [];
|
||||
}
|
||||
row = serializeRowHeader('P', id) + stringify({reason, stack, env}) + '\n';
|
||||
} else {
|
||||
// No reason included in prod.
|
||||
row = serializeRowHeader('P', id) + '\n';
|
||||
}
|
||||
const processedChunk = stringToChunk(row);
|
||||
request.completedErrorChunks.push(processedChunk);
|
||||
}
|
||||
|
||||
function serializeErrorValue(request: Request, error: Error): string {
|
||||
if (__DEV__) {
|
||||
let name: string = 'Error';
|
||||
@@ -5716,26 +5628,15 @@ function erroredTask(request: Request, task: Task, error: mixed): void {
|
||||
}
|
||||
}
|
||||
task.status = ERRORED;
|
||||
if (
|
||||
enablePostpone &&
|
||||
typeof error === 'object' &&
|
||||
error !== null &&
|
||||
error.$$typeof === REACT_POSTPONE_TYPE
|
||||
) {
|
||||
const postponeInstance: Postpone = (error: any);
|
||||
logPostpone(request, postponeInstance.message, task);
|
||||
emitPostponeChunk(request, task.id, postponeInstance);
|
||||
} else {
|
||||
const digest = logRecoverableError(request, error, task);
|
||||
emitErrorChunk(
|
||||
request,
|
||||
task.id,
|
||||
digest,
|
||||
error,
|
||||
false,
|
||||
__DEV__ ? task.debugOwner : null,
|
||||
);
|
||||
}
|
||||
const digest = logRecoverableError(request, error, task);
|
||||
emitErrorChunk(
|
||||
request,
|
||||
task.id,
|
||||
digest,
|
||||
error,
|
||||
false,
|
||||
__DEV__ ? task.debugOwner : null,
|
||||
);
|
||||
request.abortableTasks.delete(task);
|
||||
callOnAllReadyIfReady(request);
|
||||
}
|
||||
@@ -6274,22 +6175,6 @@ export function abort(request: Request, reason: mixed): void {
|
||||
// and leave the reference unfulfilled.
|
||||
abortableTasks.forEach(task => haltTask(task, request));
|
||||
scheduleWork(() => finishHalt(request, abortableTasks));
|
||||
} else if (
|
||||
enablePostpone &&
|
||||
typeof reason === 'object' &&
|
||||
reason !== null &&
|
||||
(reason: any).$$typeof === REACT_POSTPONE_TYPE
|
||||
) {
|
||||
const postponeInstance: Postpone = (reason: any);
|
||||
logPostpone(request, postponeInstance.message, null);
|
||||
// When rendering we produce a shared postpone chunk and then
|
||||
// fulfill each task with a reference to that chunk.
|
||||
const errorId = request.nextChunkId++;
|
||||
request.fatalError = errorId;
|
||||
request.pendingChunks++;
|
||||
emitPostponeChunk(request, errorId, postponeInstance);
|
||||
abortableTasks.forEach(task => abortTask(task, request, errorId));
|
||||
scheduleWork(() => finishAbort(request, abortableTasks, errorId));
|
||||
} else {
|
||||
const error =
|
||||
reason === undefined
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
*/
|
||||
|
||||
import {REACT_POSTPONE_TYPE} from 'shared/ReactSymbols';
|
||||
|
||||
declare class Postpone extends Error {
|
||||
$$typeof: symbol;
|
||||
}
|
||||
|
||||
export type {Postpone};
|
||||
|
||||
export function postpone(reason: string): void {
|
||||
// eslint-disable-next-line react-internal/prod-error-codes
|
||||
const postponeInstance: Postpone = (new Error(reason): any);
|
||||
postponeInstance.$$typeof = REACT_POSTPONE_TYPE;
|
||||
throw postponeInstance;
|
||||
}
|
||||
@@ -80,8 +80,6 @@ export const enableAsyncIterableChildren = __EXPERIMENTAL__;
|
||||
|
||||
export const enableTaint = __EXPERIMENTAL__;
|
||||
|
||||
export const enablePostpone: boolean = false; // Probably won't ship in this form.
|
||||
|
||||
export const enableHalt: boolean = true;
|
||||
|
||||
export const enableViewTransition: boolean = true;
|
||||
|
||||
@@ -44,8 +44,6 @@ export const REACT_MEMO_CACHE_SENTINEL: symbol = Symbol.for(
|
||||
'react.memo_cache_sentinel',
|
||||
);
|
||||
|
||||
export const REACT_POSTPONE_TYPE: symbol = Symbol.for('react.postpone');
|
||||
|
||||
export const REACT_VIEW_TRANSITION_TYPE: symbol = Symbol.for(
|
||||
'react.view_transition',
|
||||
);
|
||||
|
||||
@@ -51,7 +51,6 @@ export const enableLegacyCache: boolean = false;
|
||||
export const enableLegacyFBSupport: boolean = false;
|
||||
export const enableLegacyHidden: boolean = false;
|
||||
export const enableNoCloningMemoCache: boolean = false;
|
||||
export const enablePostpone: boolean = false;
|
||||
export const enableProfilerCommitHooks: boolean = __PROFILE__;
|
||||
export const enableProfilerNestedUpdatePhase: boolean = __PROFILE__;
|
||||
export const enableProfilerTimer: boolean = __PROFILE__;
|
||||
|
||||
@@ -38,7 +38,6 @@ export const enableLegacyFBSupport: boolean = false;
|
||||
export const enableLegacyHidden: boolean = false;
|
||||
export const enableNoCloningMemoCache: boolean = false;
|
||||
export const enableObjectFiber: boolean = false;
|
||||
export const enablePostpone: boolean = false;
|
||||
export const enableReactTestRendererWarning: boolean = false;
|
||||
export const enableRetryLaneExpiration: boolean = false;
|
||||
export const enableComponentPerformanceTrack: boolean = true;
|
||||
|
||||
@@ -21,7 +21,6 @@ export const enableUpdaterTracking: boolean = false;
|
||||
export const enableLegacyCache: boolean = __EXPERIMENTAL__;
|
||||
export const enableAsyncIterableChildren: boolean = false;
|
||||
export const enableTaint: boolean = true;
|
||||
export const enablePostpone: boolean = false;
|
||||
export const enableHalt: boolean = true;
|
||||
export const disableCommentsAsDOMContainers: boolean = true;
|
||||
export const disableInputAttributeSyncing: boolean = false;
|
||||
|
||||
@@ -33,7 +33,6 @@ export const enableLegacyFBSupport = false;
|
||||
export const enableLegacyHidden = false;
|
||||
export const enableNoCloningMemoCache = false;
|
||||
export const enableObjectFiber = false;
|
||||
export const enablePostpone = false;
|
||||
export const enableProfilerCommitHooks = __PROFILE__;
|
||||
export const enableProfilerNestedUpdatePhase = __PROFILE__;
|
||||
export const enableProfilerTimer = __PROFILE__;
|
||||
|
||||
@@ -21,7 +21,6 @@ export const enableUpdaterTracking: boolean = false;
|
||||
export const enableLegacyCache: boolean = true;
|
||||
export const enableAsyncIterableChildren: boolean = false;
|
||||
export const enableTaint: boolean = true;
|
||||
export const enablePostpone: boolean = false;
|
||||
export const enableHalt: boolean = true;
|
||||
export const disableCommentsAsDOMContainers: boolean = true;
|
||||
export const disableInputAttributeSyncing: boolean = false;
|
||||
|
||||
@@ -73,8 +73,6 @@ export const enableAsyncIterableChildren: boolean = false;
|
||||
|
||||
export const enableTaint: boolean = false;
|
||||
|
||||
export const enablePostpone: boolean = false;
|
||||
|
||||
export const enableHalt: boolean = true;
|
||||
|
||||
// TODO: www currently relies on this feature. It's disabled in open source.
|
||||
|
||||
Reference in new issue
Block a user