Remove Blocks (#20138)
* Remove Blocks * Remove Flight Server Runtime There's no need for this now that the JSResource is part of the bundler protocol. Might need something for Webpack plugin specifically later. * Devtools
Sebastian Markbåge committed
Oct 31, 2020 at 02:03 UTC
56e9feead0f91075ba0a4f725c9e4e343bca1c67
61 files changed
+39
-1627
packages/react-client/src/ReactFlightClient.js
+6
-72
@@ -8,7 +8,6 @@
8
*/
9
10
import type {Wakeable} from 'shared/ReactTypes';
11
-import type {BlockComponent, BlockRenderFunction} from 'react/src/ReactBlock';
11
import type {LazyComponent} from 'react/src/ReactLazy';
12
13
import type {
@@ -25,11 +24,7 @@ import {
24
parseModel,
25
} from './ReactFlightClientHostConfig';
26
28
-import {
29
- REACT_LAZY_TYPE,
30
- REACT_BLOCK_TYPE,
31
- REACT_ELEMENT_TYPE,
32
-} from 'shared/ReactSymbols';
27
+import {REACT_LAZY_TYPE, REACT_ELEMENT_TYPE} from 'shared/ReactSymbols';
28
29
export type JSONValue =
30
| number
@@ -229,15 +224,6 @@ export function reportGlobalError(response: Response, error: Error): void {
224
});
225
}
226
232
-function readMaybeChunk<T>(maybeChunk: SomeChunk<T> | T): T {
233
- if (maybeChunk == null || !(maybeChunk instanceof Chunk)) {
234
- // $FlowFixMe
235
- return maybeChunk;
236
- }
237
- const chunk: SomeChunk<T> = (maybeChunk: any);
238
- return readChunk(chunk);
239
-}
240
-
227
function createElement(type, key, props): React$Element<any> {
228
const element: any = {
229
// This tag allows us to uniquely identify this as a React Element
@@ -279,45 +265,6 @@ function createElement(type, key, props): React$Element<any> {
265
return element;
266
}
267
282
-type UninitializedBlockPayload<Data> = [
283
- mixed,
284
- BlockRenderFunction<any, Data> | SomeChunk<BlockRenderFunction<any, Data>>,
285
- Data | SomeChunk<Data>,
286
- Response,
287
-];
288
-
289
-function initializeBlock<Props, Data>(
290
- tuple: UninitializedBlockPayload<Data>,
291
-): BlockComponent<Props, Data> {
292
- // Require module first and then data. The ordering matters.
293
- const moduleExport = readMaybeChunk(tuple[1]);
294
-
295
- // The ordering here is important because this call might suspend.
296
- // We don't want that to prevent the module graph for being initialized.
297
- const data: Data = readMaybeChunk(tuple[2]);
298
-
299
- return {
300
- $$typeof: REACT_BLOCK_TYPE,
301
- _status: -1,
302
- _data: data,
303
- _render: moduleExport,
304
- };
305
-}
306
-
307
-function createLazyBlock<Props, Data>(
308
- tuple: UninitializedBlockPayload<Data>,
309
-): LazyComponent<BlockComponent<Props, Data>, UninitializedBlockPayload<Data>> {
310
- const lazyType: LazyComponent<
311
- BlockComponent<Props, Data>,
312
- UninitializedBlockPayload<Data>,
313
- > = {
314
- $$typeof: REACT_LAZY_TYPE,
315
- _payload: tuple,
316
- _init: initializeBlock,
317
- };
318
- return lazyType;
319
-}
320
-
268
function createLazyChunkWrapper<T>(
269
chunk: SomeChunk<T>,
270
): LazyComponent<T, SomeChunk<T>> {
@@ -354,25 +301,15 @@ export function parseModelString(
301
} else {
302
const id = parseInt(value.substring(1), 16);
303
const chunk = getChunk(response, id);
357
- if (parentObject[0] === REACT_BLOCK_TYPE) {
358
- // Block types know how to deal with lazy values.
359
- return chunk;
360
- }
361
- // For anything else we must Suspend this block if
362
- // we don't yet have the value.
304
return readChunk(chunk);
305
}
306
}
307
case '@': {
367
- if (value === '@') {
368
- return REACT_BLOCK_TYPE;
369
- } else {
370
- const id = parseInt(value.substring(1), 16);
371
- const chunk = getChunk(response, id);
372
- // We create a React.lazy wrapper around any lazy values.
373
- // When passed into React, we'll know how to suspend on this.
374
- return createLazyChunkWrapper(chunk);
375
- }
308
+ const id = parseInt(value.substring(1), 16);
309
+ const chunk = getChunk(response, id);
310
+ // We create a React.lazy wrapper around any lazy values.
311
+ // When passed into React, we'll know how to suspend on this.
312
+ return createLazyChunkWrapper(chunk);
313
}
314
}
315
return value;
@@ -387,9 +324,6 @@ export function parseModelTuple(
324
// TODO: Consider having React just directly accept these arrays as elements.
325
// Or even change the ReactElement type to be an array.
326
return createElement(tuple[1], tuple[2], tuple[3]);
390
- } else if (tuple[0] === REACT_BLOCK_TYPE) {
391
- // TODO: Consider having React just directly accept these arrays as blocks.
392
- return createLazyBlock((tuple: any));
327
}
328
return value;
329
}
packages/react-client/src/__tests__/ReactFlight-test.js
-76
@@ -10,13 +10,10 @@
10
11
'use strict';
12
13
-const ReactFeatureFlags = require('shared/ReactFeatureFlags');
14
-
13
let act;
14
let React;
15
let ReactNoop;
16
let ReactNoopFlightServer;
19
-let ReactNoopFlightServerRuntime;
17
let ReactNoopFlightClient;
18
let ErrorBoundary;
19
@@ -27,7 +24,6 @@ describe('ReactFlight', () => {
24
React = require('react');
25
ReactNoop = require('react-noop-renderer');
26
ReactNoopFlightServer = require('react-noop-renderer/flight-server');
30
- ReactNoopFlightServerRuntime = require('react-noop-renderer/flight-server-runtime');
27
ReactNoopFlightClient = require('react-noop-renderer/flight-client');
28
act = ReactNoop.act;
29
@@ -60,25 +56,6 @@ describe('ReactFlight', () => {
56
};
57
}
58
63
- function block(render, load) {
64
- if (load === undefined) {
65
- return () => {
66
- return ReactNoopFlightServerRuntime.serverBlockNoData(
67
- moduleReference(render),
68
- );
69
- };
70
- }
71
- return function(...args) {
72
- const curriedLoad = () => {
73
- return load(...args);
74
- };
75
- return ReactNoopFlightServerRuntime.serverBlock(
76
- moduleReference(render),
77
- curriedLoad,
78
- );
79
- };
80
- }
81
-
59
it('can render a server component', () => {
60
function Bar({text}) {
61
return text.toUpperCase();
@@ -138,59 +115,6 @@ describe('ReactFlight', () => {
115
expect(ReactNoop).toMatchRenderedOutput(<span>Hello, Seb Smith</span>);
116
});
117
141
- if (ReactFeatureFlags.enableBlocksAPI) {
142
- it('can transfer a Block to the client and render there, without data', () => {
143
- function User(props, data) {
144
- return (
145
- <span>
146
- {props.greeting} {typeof data}
147
- </span>
148
- );
149
- }
150
- const loadUser = block(User);
151
- const model = {
152
- User: loadUser('Seb', 'Smith'),
153
- };
154
-
155
- const transport = ReactNoopFlightServer.render(model);
156
-
157
- act(() => {
158
- const rootModel = ReactNoopFlightClient.read(transport);
159
- const UserClient = rootModel.User;
160
- ReactNoop.render(<UserClient greeting="Hello" />);
161
- });
162
-
163
- expect(ReactNoop).toMatchRenderedOutput(<span>Hello undefined</span>);
164
- });
165
-
166
- it('can transfer a Block to the client and render there, with data', () => {
167
- function load(firstName, lastName) {
168
- return {name: firstName + ' ' + lastName};
169
- }
170
- function User(props, data) {
171
- return (
172
- <span>
173
- {props.greeting}, {data.name}
174
- </span>
175
- );
176
- }
177
- const loadUser = block(User, load);
178
- const model = {
179
- User: loadUser('Seb', 'Smith'),
180
- };
181
-
182
- const transport = ReactNoopFlightServer.render(model);
183
-
184
- act(() => {
185
- const rootModel = ReactNoopFlightClient.read(transport);
186
- const UserClient = rootModel.User;
187
- ReactNoop.render(<UserClient greeting="Hello" />);
188
- });
189
-
190
- expect(ReactNoop).toMatchRenderedOutput(<span>Hello, Seb Smith</span>);
191
- });
192
- }
193
-
118
it('should error if a non-serializable value is passed to a host component', () => {
119
function EventHandlerProp() {
120
return (
packages/react-debug-tools/src/ReactDebugHooks.js
+1
-3
@@ -30,7 +30,6 @@ import {
30
SimpleMemoComponent,
31
ContextProvider,
32
ForwardRef,
33
- Block,
33
} from 'react-reconciler/src/ReactWorkTags';
34
35
type CurrentDispatcherRef = typeof ReactSharedInternals.ReactCurrentDispatcher;
@@ -667,8 +666,7 @@ export function inspectHooksOfFiber(
666
if (
667
fiber.tag !== FunctionComponent &&
668
fiber.tag !== SimpleMemoComponent &&
670
- fiber.tag !== ForwardRef &&
671
- fiber.tag !== Block
669
+ fiber.tag !== ForwardRef
670
) {
671
throw new Error(
672
'Unknown Fiber. Needs to be a function component to inspect hooks.',
packages/react-devtools-shared/src/backend/DevToolsComponentStackFrame.js
-10
@@ -17,8 +17,6 @@ import type {LazyComponent} from 'react/src/ReactLazy';
17
import type {CurrentDispatcherRef} from './types';
18
19
import {
20
- BLOCK_NUMBER,
21
- BLOCK_SYMBOL_STRING,
20
FORWARD_REF_NUMBER,
21
FORWARD_REF_SYMBOL_STRING,
22
LAZY_NUMBER,
@@ -276,14 +274,6 @@ export function describeUnknownElementTypeFrameInDEV(
274
ownerFn,
275
currentDispatcherRef,
276
);
279
- case BLOCK_NUMBER:
280
- case BLOCK_SYMBOL_STRING:
281
- return describeFunctionComponentFrame(
282
- type._render,
283
- source,
284
- ownerFn,
285
- currentDispatcherRef,
286
- );
277
case LAZY_NUMBER:
278
case LAZY_SYMBOL_STRING: {
279
const lazyComponent: LazyComponent<any, any> = (type: any);
packages/react-devtools-shared/src/backend/DevToolsFiberComponentStack.js
-8
@@ -35,7 +35,6 @@ function describeFiber(
35
IndeterminateComponent,
36
SimpleMemoComponent,
37
ForwardRef,
38
- Block,
38
ClassComponent,
39
} = workTagMap;
40
@@ -70,13 +69,6 @@ function describeFiber(
69
owner,
70
currentDispatcherRef,
71
);
73
- case Block:
74
- return describeFunctionComponentFrame(
75
- workInProgress.type._render,
76
- source,
77
- owner,
78
- currentDispatcherRef,
79
- );
72
case ClassComponent:
73
return describeClassComponentFrame(
74
workInProgress.type,
packages/react-devtools-shared/src/backend/ReactSymbols.js
-6
@@ -13,9 +13,6 @@
13
// 2. DevTools must support both Symbol and numeric forms of each symbol;
14
// Since e.g. standalone DevTools runs in a separate process, it can't rely on its own ES capabilities.
15
16
-export const BLOCK_NUMBER = 0xead9;
17
-export const BLOCK_SYMBOL_STRING = 'Symbol(react.block)';
18
-
16
export const CONCURRENT_MODE_NUMBER = 0xeacf;
17
export const CONCURRENT_MODE_SYMBOL_STRING = 'Symbol(react.concurrent_mode)';
18
@@ -61,9 +58,6 @@ export const PROVIDER_SYMBOL_STRING = 'Symbol(react.provider)';
58
export const SCOPE_NUMBER = 0xead7;
59
export const SCOPE_SYMBOL_STRING = 'Symbol(react.scope)';
60
64
-export const SERVER_BLOCK_NUMBER = 0xeada;
65
-export const SERVER_BLOCK_SYMBOL_STRING = 'Symbol(react.server.block)';
66
-
61
export const STRICT_MODE_NUMBER = 0xeacc;
62
export const STRICT_MODE_SYMBOL_STRING = 'Symbol(react.strict_mode)';
63
packages/react-devtools-shared/src/backend/renderer.js
+1
-5
@@ -169,7 +169,6 @@ export function getInternalReactConstants(
169
if (gte(version, '17.0.0-alpha')) {
170
// TODO (Offscreen) Update the version number above to reflect the first Offscreen alpha/beta release.
171
ReactTypeOfWork = {
172
- Block: 22,
172
ClassComponent: 1,
173
ContextConsumer: 9,
174
ContextProvider: 10,
@@ -188,7 +187,7 @@ export function getInternalReactConstants(
187
LazyComponent: 16,
188
MemoComponent: 14,
189
Mode: 8,
191
- OffscreenComponent: 23, // Experimental
190
+ OffscreenComponent: 22, // Experimental
191
Profiler: 12,
192
SimpleMemoComponent: 15,
193
SuspenseComponent: 13,
@@ -197,7 +196,6 @@ export function getInternalReactConstants(
196
};
197
} else if (gte(version, '16.6.0-beta.0')) {
198
ReactTypeOfWork = {
200
- Block: 22,
199
ClassComponent: 1,
200
ContextConsumer: 9,
201
ContextProvider: 10,
@@ -225,7 +223,6 @@ export function getInternalReactConstants(
223
};
224
} else if (gte(version, '16.4.3-alpha')) {
225
ReactTypeOfWork = {
228
- Block: -1, // Doesn't exist yet
226
ClassComponent: 2,
227
ContextConsumer: 11,
228
ContextProvider: 12,
@@ -253,7 +250,6 @@ export function getInternalReactConstants(
250
};
251
} else {
252
ReactTypeOfWork = {
256
- Block: -1, // Doesn't exist yet
253
ClassComponent: 2,
254
ContextConsumer: 12,
255
ContextProvider: 13,
packages/react-devtools-shared/src/backend/types.js
-1
@@ -26,7 +26,6 @@ export type WorkFlags = number;
26
export type ExpirationTime = number;
27
28
export type WorkTagMap = {|
29
- Block: WorkTag,
29
ClassComponent: WorkTag,
30
ContextConsumer: WorkTag,
31
ContextProvider: WorkTag,
packages/react-noop-renderer/flight-server-runtime.js
deleted
-10
@@ -1,10 +0,0 @@
1
-/**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-export * from 'react-server/flight-server-runtime';
packages/react-noop-renderer/npm/flight-server-runtime.js
deleted
-3
@@ -1,3 +0,0 @@
1
-'use strict';
2
-
3
-module.exports = require('react-server/flight-server-runtime');
packages/react-noop-renderer/package.json
-1
@@ -29,7 +29,6 @@
29
"flight-client.js",
30
"flight-modules.js",
31
"flight-server.js",
32
- "flight-server-runtime.js",
32
"cjs/"
33
]
34
}
packages/react-reconciler/src/ReactChildFiber.new.js
-71
@@ -9,8 +9,6 @@
9
10
import type {ReactElement} from 'shared/ReactElementType';
11
import type {ReactPortal} from 'shared/ReactTypes';
12
-import type {BlockComponent} from 'react/src/ReactBlock';
13
-import type {LazyComponent} from 'react/src/ReactLazy';
12
import type {Fiber} from './ReactInternalTypes';
13
import type {Lanes} from './ReactFiberLane';
14
@@ -22,7 +20,6 @@ import {
20
REACT_FRAGMENT_TYPE,
21
REACT_PORTAL_TYPE,
22
REACT_LAZY_TYPE,
25
- REACT_BLOCK_TYPE,
23
} from 'shared/ReactSymbols';
24
import {
25
FunctionComponent,
@@ -32,12 +29,10 @@ import {
29
ForwardRef,
30
Fragment,
31
SimpleMemoComponent,
35
- Block,
32
} from './ReactWorkTags';
33
import invariant from 'shared/invariant';
34
import {
35
warnAboutStringRefs,
40
- enableBlocksAPI,
36
enableLazyElements,
37
} from 'shared/ReactFeatureFlags';
38
@@ -251,22 +246,6 @@ function warnOnFunctionType(returnFiber: Fiber) {
246
}
247
}
248
254
-// We avoid inlining this to avoid potential deopts from using try/catch.
255
-/** @noinline */
256
-function resolveLazyType<T, P>(
257
- lazyComponent: LazyComponent<T, P>,
258
-): LazyComponent<T, P> | T {
259
- try {
260
- // If we can, let's peek at the resulting type.
261
- const payload = lazyComponent._payload;
262
- const init = lazyComponent._init;
263
- return init(payload);
264
- } catch (x) {
265
- // Leave it in place and let it throw again in the begin phase.
266
- return lazyComponent;
267
- }
268
-}
269
-
249
// This wrapper function exists because I expect to clone the code in each path
250
// to be able to optimize each path individually by branching early. This needs
251
// a compiler or we can do it manually. Helpers that don't need this branching
@@ -412,28 +391,6 @@ function ChildReconciler(shouldTrackSideEffects) {
391
existing._debugOwner = element._owner;
392
}
393
return existing;
415
- } else if (enableBlocksAPI && current.tag === Block) {
416
- // The new Block might not be initialized yet. We need to initialize
417
- // it in case initializing it turns out it would match.
418
- let type = element.type;
419
- if (type.$$typeof === REACT_LAZY_TYPE) {
420
- type = resolveLazyType(type);
421
- }
422
- if (
423
- type.$$typeof === REACT_BLOCK_TYPE &&
424
- ((type: any): BlockComponent<any, any>)._render ===
425
- (current.type: BlockComponent<any, any>)._render
426
- ) {
427
- // Same as above but also update the .type field.
428
- const existing = useFiber(current, element.props);
429
- existing.return = returnFiber;
430
- existing.type = type;
431
- if (__DEV__) {
432
- existing._debugSource = element._source;
433
- existing._debugOwner = element._owner;
434
- }
435
- return existing;
436
- }
394
}
395
}
396
// Insert
@@ -1151,33 +1108,6 @@ function ChildReconciler(shouldTrackSideEffects) {
1108
}
1109
break;
1110
}
1154
- case Block:
1155
- if (enableBlocksAPI) {
1156
- let type = element.type;
1157
- if (type.$$typeof === REACT_LAZY_TYPE) {
1158
- type = resolveLazyType(type);
1159
- }
1160
- if (type.$$typeof === REACT_BLOCK_TYPE) {
1161
- // The new Block might not be initialized yet. We need to initialize
1162
- // it in case initializing it turns out it would match.
1163
- if (
1164
- ((type: any): BlockComponent<any, any>)._render ===
1165
- (child.type: BlockComponent<any, any>)._render
1166
- ) {
1167
- deleteRemainingChildren(returnFiber, child.sibling);
1168
- const existing = useFiber(child, element.props);
1169
- existing.type = type;
1170
- existing.return = returnFiber;
1171
- if (__DEV__) {
1172
- existing._debugSource = element._source;
1173
- existing._debugOwner = element._owner;
1174
- }
1175
- return existing;
1176
- }
1177
- }
1178
- }
1179
- // We intentionally fallthrough here if enableBlocksAPI is not on.
1180
- // eslint-disable-next-lined no-fallthrough
1111
default: {
1112
if (
1113
child.elementType === element.type ||
@@ -1380,7 +1310,6 @@ function ChildReconciler(shouldTrackSideEffects) {
1310
// Intentionally fall through to the next case, which handles both
1311
// functions and classes
1312
// eslint-disable-next-lined no-fallthrough
1383
- case Block:
1313
case FunctionComponent:
1314
case ForwardRef:
1315
case SimpleMemoComponent: {
packages/react-reconciler/src/ReactChildFiber.old.js
-71
@@ -9,8 +9,6 @@
9
10
import type {ReactElement} from 'shared/ReactElementType';
11
import type {ReactPortal} from 'shared/ReactTypes';
12
-import type {BlockComponent} from 'react/src/ReactBlock';
13
-import type {LazyComponent} from 'react/src/ReactLazy';
12
import type {Fiber} from './ReactInternalTypes';
13
import type {Lanes} from './ReactFiberLane';
14
@@ -22,7 +20,6 @@ import {
20
REACT_FRAGMENT_TYPE,
21
REACT_PORTAL_TYPE,
22
REACT_LAZY_TYPE,
25
- REACT_BLOCK_TYPE,
23
} from 'shared/ReactSymbols';
24
import {
25
FunctionComponent,
@@ -32,12 +29,10 @@ import {
29
ForwardRef,
30
Fragment,
31
SimpleMemoComponent,
35
- Block,
32
} from './ReactWorkTags';
33
import invariant from 'shared/invariant';
34
import {
35
warnAboutStringRefs,
40
- enableBlocksAPI,
36
enableLazyElements,
37
} from 'shared/ReactFeatureFlags';
38
@@ -251,22 +246,6 @@ function warnOnFunctionType(returnFiber: Fiber) {
246
}
247
}
248
254
-// We avoid inlining this to avoid potential deopts from using try/catch.
255
-/** @noinline */
256
-function resolveLazyType<T, P>(
257
- lazyComponent: LazyComponent<T, P>,
258
-): LazyComponent<T, P> | T {
259
- try {
260
- // If we can, let's peek at the resulting type.
261
- const payload = lazyComponent._payload;
262
- const init = lazyComponent._init;
263
- return init(payload);
264
- } catch (x) {
265
- // Leave it in place and let it throw again in the begin phase.
266
- return lazyComponent;
267
- }
268
-}
269
-
249
// This wrapper function exists because I expect to clone the code in each path
250
// to be able to optimize each path individually by branching early. This needs
251
// a compiler or we can do it manually. Helpers that don't need this branching
@@ -419,28 +398,6 @@ function ChildReconciler(shouldTrackSideEffects) {
398
existing._debugOwner = element._owner;
399
}
400
return existing;
422
- } else if (enableBlocksAPI && current.tag === Block) {
423
- // The new Block might not be initialized yet. We need to initialize
424
- // it in case initializing it turns out it would match.
425
- let type = element.type;
426
- if (type.$$typeof === REACT_LAZY_TYPE) {
427
- type = resolveLazyType(type);
428
- }
429
- if (
430
- type.$$typeof === REACT_BLOCK_TYPE &&
431
- ((type: any): BlockComponent<any, any>)._render ===
432
- (current.type: BlockComponent<any, any>)._render
433
- ) {
434
- // Same as above but also update the .type field.
435
- const existing = useFiber(current, element.props);
436
- existing.return = returnFiber;
437
- existing.type = type;
438
- if (__DEV__) {
439
- existing._debugSource = element._source;
440
- existing._debugOwner = element._owner;
441
- }
442
- return existing;
443
- }
401
}
402
}
403
// Insert
@@ -1158,33 +1115,6 @@ function ChildReconciler(shouldTrackSideEffects) {
1115
}
1116
break;
1117
}
1161
- case Block:
1162
- if (enableBlocksAPI) {
1163
- let type = element.type;
1164
- if (type.$$typeof === REACT_LAZY_TYPE) {
1165
- type = resolveLazyType(type);
1166
- }
1167
- if (type.$$typeof === REACT_BLOCK_TYPE) {
1168
- // The new Block might not be initialized yet. We need to initialize
1169
- // it in case initializing it turns out it would match.
1170
- if (
1171
- ((type: any): BlockComponent<any, any>)._render ===
1172
- (child.type: BlockComponent<any, any>)._render
1173
- ) {
1174
- deleteRemainingChildren(returnFiber, child.sibling);
1175
- const existing = useFiber(child, element.props);
1176
- existing.type = type;
1177
- existing.return = returnFiber;
1178
- if (__DEV__) {
1179
- existing._debugSource = element._source;
1180
- existing._debugOwner = element._owner;
1181
- }
1182
- return existing;
1183
- }
1184
- }
1185
- }
1186
- // We intentionally fallthrough here if enableBlocksAPI is not on.
1187
- // eslint-disable-next-lined no-fallthrough
1118
default: {
1119
if (
1120
child.elementType === element.type ||
@@ -1387,7 +1317,6 @@ function ChildReconciler(shouldTrackSideEffects) {
1317
// Intentionally fall through to the next case, which handles both
1318
// functions and classes
1319
// eslint-disable-next-lined no-fallthrough
1390
- case Block:
1320
case FunctionComponent:
1321
case ForwardRef:
1322
case SimpleMemoComponent: {
packages/react-reconciler/src/ReactFiber.new.js
-11
@@ -27,7 +27,6 @@ import {
27
enableProfilerTimer,
28
enableFundamentalAPI,
29
enableScopeAPI,
30
- enableBlocksAPI,
30
} from 'shared/ReactFeatureFlags';
31
import {NoFlags, Placement, StaticMask} from './ReactFiberFlags';
32
import {ConcurrentRoot, BlockingRoot} from './ReactRootTags';
@@ -53,7 +52,6 @@ import {
52
LazyComponent,
53
FundamentalComponent,
54
ScopeComponent,
56
- Block,
55
OffscreenComponent,
56
LegacyHiddenComponent,
57
} from './ReactWorkTags';
@@ -88,7 +86,6 @@ import {
86
REACT_LAZY_TYPE,
87
REACT_FUNDAMENTAL_TYPE,
88
REACT_SCOPE_TYPE,
91
- REACT_BLOCK_TYPE,
89
REACT_OFFSCREEN_TYPE,
90
REACT_LEGACY_HIDDEN_TYPE,
91
} from 'shared/ReactSymbols';
@@ -239,11 +236,6 @@ export function resolveLazyComponentTag(Component: Function): WorkTag {
236
if ($$typeof === REACT_MEMO_TYPE) {
237
return MemoComponent;
238
}
242
- if (enableBlocksAPI) {
243
- if ($$typeof === REACT_BLOCK_TYPE) {
244
- return Block;
245
- }
246
- }
239
}
240
return IndeterminateComponent;
241
}
@@ -516,9 +508,6 @@ export function createFiberFromTypeAndProps(
508
fiberTag = LazyComponent;
509
resolvedType = null;
510
break getTag;
519
- case REACT_BLOCK_TYPE:
520
- fiberTag = Block;
521
- break getTag;
511
case REACT_FUNDAMENTAL_TYPE:
512
if (enableFundamentalAPI) {
513
return createFiberFromFundamental(
packages/react-reconciler/src/ReactFiber.old.js
-11
@@ -27,7 +27,6 @@ import {
27
enableProfilerTimer,
28
enableFundamentalAPI,
29
enableScopeAPI,
30
- enableBlocksAPI,
30
} from 'shared/ReactFeatureFlags';
31
import {NoFlags, Placement} from './ReactFiberFlags';
32
import {ConcurrentRoot, BlockingRoot} from './ReactRootTags';
@@ -53,7 +52,6 @@ import {
52
LazyComponent,
53
FundamentalComponent,
54
ScopeComponent,
56
- Block,
55
OffscreenComponent,
56
LegacyHiddenComponent,
57
} from './ReactWorkTags';
@@ -88,7 +86,6 @@ import {
86
REACT_LAZY_TYPE,
87
REACT_FUNDAMENTAL_TYPE,
88
REACT_SCOPE_TYPE,
91
- REACT_BLOCK_TYPE,
89
REACT_OFFSCREEN_TYPE,
90
REACT_LEGACY_HIDDEN_TYPE,
91
} from 'shared/ReactSymbols';
@@ -241,11 +238,6 @@ export function resolveLazyComponentTag(Component: Function): WorkTag {
238
if ($$typeof === REACT_MEMO_TYPE) {
239
return MemoComponent;
240
}
244
- if (enableBlocksAPI) {
245
- if ($$typeof === REACT_BLOCK_TYPE) {
246
- return Block;
247
- }
248
- }
241
}
242
return IndeterminateComponent;
243
}
@@ -522,9 +514,6 @@ export function createFiberFromTypeAndProps(
514
fiberTag = LazyComponent;
515
resolvedType = null;
516
break getTag;
525
- case REACT_BLOCK_TYPE:
526
- fiberTag = Block;
527
- break getTag;
517
case REACT_FUNDAMENTAL_TYPE:
518
if (enableFundamentalAPI) {
519
return createFiberFromFundamental(
packages/react-reconciler/src/ReactFiberBeginWork.new.js
-94
@@ -8,7 +8,6 @@
8
*/
9
10
import type {ReactProviderType, ReactContext} from 'shared/ReactTypes';
11
-import type {BlockComponent} from 'react/src/ReactBlock';
11
import type {LazyComponent as LazyComponentType} from 'react/src/ReactLazy';
12
import type {Fiber} from './ReactInternalTypes';
13
import type {FiberRoot} from './ReactInternalTypes';
@@ -49,7 +48,6 @@ import {
48
IncompleteClassComponent,
49
FundamentalComponent,
50
ScopeComponent,
52
- Block,
51
OffscreenComponent,
52
LegacyHiddenComponent,
53
} from './ReactWorkTags';
@@ -76,7 +74,6 @@ import {
74
enableFundamentalAPI,
75
warnAboutDefaultPropsOnFunctionComponents,
76
enableScopeAPI,
79
- enableBlocksAPI,
77
} from 'shared/ReactFeatureFlags';
78
import invariant from 'shared/invariant';
79
import shallowEqual from 'shared/shallowEqual';
@@ -780,75 +777,6 @@ function updateFunctionComponent(
777
return workInProgress.child;
778
}
779
783
-function updateBlock<Props, Data>(
784
- current: Fiber | null,
785
- workInProgress: Fiber,
786
- block: BlockComponent<Props, Data>,
787
- nextProps: any,
788
- renderLanes: Lanes,
789
-) {
790
- // TODO: current can be non-null here even if the component
791
- // hasn't yet mounted. This happens after the first render suspends.
792
- // We'll need to figure out if this is fine or can cause issues.
793
-
794
- const render = block._render;
795
- const data = block._data;
796
-
797
- // The rest is a fork of updateFunctionComponent
798
- let nextChildren;
799
- prepareToReadContext(workInProgress, renderLanes);
800
- if (__DEV__) {
801
- ReactCurrentOwner.current = workInProgress;
802
- setIsRendering(true);
803
- nextChildren = renderWithHooks(
804
- current,
805
- workInProgress,
806
- render,
807
- nextProps,
808
- data,
809
- renderLanes,
810
- );
811
- if (
812
- debugRenderPhaseSideEffectsForStrictMode &&
813
- workInProgress.mode & StrictMode
814
- ) {
815
- disableLogs();
816
- try {
817
- nextChildren = renderWithHooks(
818
- current,
819
- workInProgress,
820
- render,
821
- nextProps,
822
- data,
823
- renderLanes,
824
- );
825
- } finally {
826
- reenableLogs();
827
- }
828
- }
829
- setIsRendering(false);
830
- } else {
831
- nextChildren = renderWithHooks(
832
- current,
833
- workInProgress,
834
- render,
835
- nextProps,
836
- data,
837
- renderLanes,
838
- );
839
- }
840
-
841
- if (current !== null && !didReceiveUpdate) {
842
- bailoutHooks(current, workInProgress, renderLanes);
843
- return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
844
- }
845
-
846
- // React DevTools reads this flag.
847
- workInProgress.flags |= PerformedWork;
848
- reconcileChildren(current, workInProgress, nextChildren, renderLanes);
849
- return workInProgress.child;
850
-}
851
-
780
function updateClassComponent(
781
current: Fiber | null,
782
workInProgress: Fiber,
@@ -1265,20 +1193,6 @@ function mountLazyComponent(
1193
);
1194
return child;
1195
}
1268
- case Block: {
1269
- if (enableBlocksAPI) {
1270
- // TODO: Resolve for Hot Reloading.
1271
- child = updateBlock(
1272
- null,
1273
- workInProgress,
1274
- Component,
1275
- props,
1276
- renderLanes,
1277
- );
1278
- return child;
1279
- }
1280
- break;
1281
- }
1196
}
1197
let hint = '';
1198
if (__DEV__) {
@@ -3454,14 +3368,6 @@ function beginWork(
3368
}
3369
break;
3370
}
3457
- case Block: {
3458
- if (enableBlocksAPI) {
3459
- const block = workInProgress.type;
3460
- const props = workInProgress.pendingProps;
3461
- return updateBlock(current, workInProgress, block, props, renderLanes);
3462
- }
3463
- break;
3464
- }
3371
case OffscreenComponent: {
3372
return updateOffscreenComponent(current, workInProgress, renderLanes);
3373
}
packages/react-reconciler/src/ReactFiberBeginWork.old.js
-94
@@ -8,7 +8,6 @@
8
*/
9
10
import type {ReactProviderType, ReactContext} from 'shared/ReactTypes';
11
-import type {BlockComponent} from 'react/src/ReactBlock';
11
import type {LazyComponent as LazyComponentType} from 'react/src/ReactLazy';
12
import type {Fiber} from './ReactInternalTypes';
13
import type {FiberRoot} from './ReactInternalTypes';
@@ -49,7 +48,6 @@ import {
48
IncompleteClassComponent,
49
FundamentalComponent,
50
ScopeComponent,
52
- Block,
51
OffscreenComponent,
52
LegacyHiddenComponent,
53
} from './ReactWorkTags';
@@ -76,7 +74,6 @@ import {
74
enableFundamentalAPI,
75
warnAboutDefaultPropsOnFunctionComponents,
76
enableScopeAPI,
79
- enableBlocksAPI,
77
} from 'shared/ReactFeatureFlags';
78
import invariant from 'shared/invariant';
79
import shallowEqual from 'shared/shallowEqual';
@@ -782,75 +779,6 @@ function updateFunctionComponent(
779
return workInProgress.child;
780
}
781
785
-function updateBlock<Props, Data>(
786
- current: Fiber | null,
787
- workInProgress: Fiber,
788
- block: BlockComponent<Props, Data>,
789
- nextProps: any,
790
- renderLanes: Lanes,
791
-) {
792
- // TODO: current can be non-null here even if the component
793
- // hasn't yet mounted. This happens after the first render suspends.
794
- // We'll need to figure out if this is fine or can cause issues.
795
-
796
- const render = block._render;
797
- const data = block._data;
798
-
799
- // The rest is a fork of updateFunctionComponent
800
- let nextChildren;
801
- prepareToReadContext(workInProgress, renderLanes);
802
- if (__DEV__) {
803
- ReactCurrentOwner.current = workInProgress;
804
- setIsRendering(true);
805
- nextChildren = renderWithHooks(
806
- current,
807
- workInProgress,
808
- render,
809
- nextProps,
810
- data,
811
- renderLanes,
812
- );
813
- if (
814
- debugRenderPhaseSideEffectsForStrictMode &&
815
- workInProgress.mode & StrictMode
816
- ) {
817
- disableLogs();
818
- try {
819
- nextChildren = renderWithHooks(
820
- current,
821
- workInProgress,
822
- render,
823
- nextProps,
824
- data,
825
- renderLanes,
826
- );
827
- } finally {
828
- reenableLogs();
829
- }
830
- }
831
- setIsRendering(false);
832
- } else {
833
- nextChildren = renderWithHooks(
834
- current,
835
- workInProgress,
836
- render,
837
- nextProps,
838
- data,
839
- renderLanes,
840
- );
841
- }
842
-
843
- if (current !== null && !didReceiveUpdate) {
844
- bailoutHooks(current, workInProgress, renderLanes);
845
- return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);
846
- }
847
-
848
- // React DevTools reads this flag.
849
- workInProgress.flags |= PerformedWork;
850
- reconcileChildren(current, workInProgress, nextChildren, renderLanes);
851
- return workInProgress.child;
852
-}
853
-
782
function updateClassComponent(
783
current: Fiber | null,
784
workInProgress: Fiber,
@@ -1264,20 +1192,6 @@ function mountLazyComponent(
1192
);
1193
return child;
1194
}
1267
- case Block: {
1268
- if (enableBlocksAPI) {
1269
- // TODO: Resolve for Hot Reloading.
1270
- child = updateBlock(
1271
- null,
1272
- workInProgress,
1273
- Component,
1274
- props,
1275
- renderLanes,
1276
- );
1277
- return child;
1278
- }
1279
- break;
1280
- }
1195
}
1196
let hint = '';
1197
if (__DEV__) {
@@ -3470,14 +3384,6 @@ function beginWork(
3384
}
3385
break;
3386
}
3473
- case Block: {
3474
- if (enableBlocksAPI) {
3475
- const block = workInProgress.type;
3476
- const props = workInProgress.pendingProps;
3477
- return updateBlock(current, workInProgress, block, props, renderLanes);
3478
- }
3479
- break;
3480
- }
3387
case OffscreenComponent: {
3388
return updateOffscreenComponent(current, workInProgress, renderLanes);
3389
}
packages/react-reconciler/src/ReactFiberCommitWork.new.js
+13
-27
@@ -55,7 +55,6 @@ import {
55
SuspenseListComponent,
56
FundamentalComponent,
57
ScopeComponent,
58
- Block,
58
OffscreenComponent,
59
LegacyHiddenComponent,
60
} from './ReactWorkTags';
@@ -540,8 +539,7 @@ function commitBeforeMutationEffectsOnFiber(finishedWork: Fiber) {
539
switch (finishedWork.tag) {
540
case FunctionComponent:
541
case ForwardRef:
543
- case SimpleMemoComponent:
544
- case Block: {
542
+ case SimpleMemoComponent: {
543
break;
544
}
545
case ClassComponent: {
@@ -1061,8 +1059,7 @@ function recursivelyCommitLayoutEffects(
1059
switch (tag) {
1060
case FunctionComponent:
1061
case ForwardRef:
1064
- case SimpleMemoComponent:
1065
- case Block: {
1062
+ case SimpleMemoComponent: {
1063
if (
1064
enableProfilerTimer &&
1065
enableProfilerCommitHooks &&
@@ -1277,8 +1274,7 @@ function commitLayoutEffectsOnFiber(
1274
switch (tag) {
1275
case FunctionComponent:
1276
case ForwardRef:
1280
- case SimpleMemoComponent:
1281
- case Block: {
1277
+ case SimpleMemoComponent: {
1278
if (
1279
enableProfilerTimer &&
1280
enableProfilerCommitHooks &&
@@ -2131,8 +2127,7 @@ function commitUnmount(
2127
case FunctionComponent:
2128
case ForwardRef:
2129
case MemoComponent:
2134
- case SimpleMemoComponent:
2135
- case Block: {
2130
+ case SimpleMemoComponent: {
2131
const updateQueue: FunctionComponentUpdateQueue | null = (current.updateQueue: any);
2132
if (updateQueue !== null) {
2133
const lastEffect = updateQueue.lastEffect;
@@ -2725,8 +2720,7 @@ function commitWork(current: Fiber | null, finishedWork: Fiber): void {
2720
case FunctionComponent:
2721
case ForwardRef:
2722
case MemoComponent:
2728
- case SimpleMemoComponent:
2729
- case Block: {
2723
+ case SimpleMemoComponent: {
2724
// Layout effects are destroyed during the mutation phase so that all
2725
// destroy functions for all fibers are called before any create functions.
2726
// This prevents sibling component effects from interfering with each other,
@@ -2793,8 +2787,7 @@ function commitWork(current: Fiber | null, finishedWork: Fiber): void {
2787
case FunctionComponent:
2788
case ForwardRef:
2789
case MemoComponent:
2796
- case SimpleMemoComponent:
2797
- case Block: {
2790
+ case SimpleMemoComponent: {
2791
// Layout effects are destroyed during the mutation phase so that all
2792
// destroy functions for all fibers are called before any create functions.
2793
// This prevents sibling component effects from interfering with each other,
@@ -3049,8 +3042,7 @@ function commitPassiveUnmountOnFiber(finishedWork: Fiber): void {
3042
switch (finishedWork.tag) {
3043
case FunctionComponent:
3044
case ForwardRef:
3052
- case SimpleMemoComponent:
3053
- case Block: {
3045
+ case SimpleMemoComponent: {
3046
if (
3047
enableProfilerTimer &&
3048
enableProfilerCommitHooks &&
@@ -3082,8 +3074,7 @@ function commitPassiveUnmountInsideDeletedTreeOnFiber(
3074
switch (current.tag) {
3075
case FunctionComponent:
3076
case ForwardRef:
3085
- case SimpleMemoComponent:
3086
- case Block: {
3077
+ case SimpleMemoComponent: {
3078
if (
3079
enableProfilerTimer &&
3080
enableProfilerCommitHooks &&
@@ -3115,8 +3106,7 @@ function commitPassiveMountOnFiber(
3106
switch (finishedWork.tag) {
3107
case FunctionComponent:
3108
case ForwardRef:
3118
- case SimpleMemoComponent:
3119
- case Block: {
3109
+ case SimpleMemoComponent: {
3110
if (
3111
enableProfilerTimer &&
3112
enableProfilerCommitHooks &&
@@ -3147,8 +3137,7 @@ function invokeLayoutEffectMountInDEV(fiber: Fiber): void {
3137
switch (fiber.tag) {
3138
case FunctionComponent:
3139
case ForwardRef:
3150
- case SimpleMemoComponent:
3151
- case Block: {
3140
+ case SimpleMemoComponent: {
3141
invokeGuardedCallback(
3142
null,
3143
commitHookEffectListMount,
@@ -3182,8 +3171,7 @@ function invokePassiveEffectMountInDEV(fiber: Fiber): void {
3171
switch (fiber.tag) {
3172
case FunctionComponent:
3173
case ForwardRef:
3185
- case SimpleMemoComponent:
3186
- case Block: {
3174
+ case SimpleMemoComponent: {
3175
invokeGuardedCallback(
3176
null,
3177
commitHookEffectListMount,
@@ -3208,8 +3196,7 @@ function invokeLayoutEffectUnmountInDEV(fiber: Fiber): void {
3196
switch (fiber.tag) {
3197
case FunctionComponent:
3198
case ForwardRef:
3211
- case SimpleMemoComponent:
3212
- case Block: {
3199
+ case SimpleMemoComponent: {
3200
invokeGuardedCallback(
3201
null,
3202
commitHookEffectListUnmount,
@@ -3242,8 +3229,7 @@ function invokePassiveEffectUnmountInDEV(fiber: Fiber): void {
3229
switch (fiber.tag) {
3230
case FunctionComponent:
3231
case ForwardRef:
3245
- case SimpleMemoComponent:
3246
- case Block: {
3232
+ case SimpleMemoComponent: {
3233
invokeGuardedCallback(
3234
null,
3235
commitHookEffectListUnmount,
packages/react-reconciler/src/ReactFiberCommitWork.old.js
+5
-11
@@ -52,7 +52,6 @@ import {
52
SuspenseListComponent,
53
FundamentalComponent,
54
ScopeComponent,
55
- Block,
55
OffscreenComponent,
56
LegacyHiddenComponent,
57
} from './ReactWorkTags';
@@ -245,8 +244,7 @@ function commitBeforeMutationLifeCycles(
244
switch (finishedWork.tag) {
245
case FunctionComponent:
246
case ForwardRef:
248
- case SimpleMemoComponent:
249
- case Block: {
247
+ case SimpleMemoComponent: {
248
return;
249
}
250
case ClassComponent: {
@@ -484,8 +482,7 @@ function commitLifeCycles(
482
switch (finishedWork.tag) {
483
case FunctionComponent:
484
case ForwardRef:
487
- case SimpleMemoComponent:
488
- case Block: {
485
+ case SimpleMemoComponent: {
486
// At this point layout effects have already been destroyed (during mutation phase).
487
// This is done to prevent sibling component effects from interfering with each other,
488
// e.g. a destroy function in one component should never override a ref set
@@ -924,8 +921,7 @@ function commitUnmount(
921
case FunctionComponent:
922
case ForwardRef:
923
case MemoComponent:
927
- case SimpleMemoComponent:
928
- case Block: {
924
+ case SimpleMemoComponent: {
925
const updateQueue: FunctionComponentUpdateQueue | null = (current.updateQueue: any);
926
if (updateQueue !== null) {
927
const lastEffect = updateQueue.lastEffect;
@@ -1486,8 +1482,7 @@ function commitWork(current: Fiber | null, finishedWork: Fiber): void {
1482
case FunctionComponent:
1483
case ForwardRef:
1484
case MemoComponent:
1489
- case SimpleMemoComponent:
1490
- case Block: {
1485
+ case SimpleMemoComponent: {
1486
// Layout effects are destroyed during the mutation phase so that all
1487
// destroy functions for all fibers are called before any create functions.
1488
// This prevents sibling component effects from interfering with each other,
@@ -1549,8 +1544,7 @@ function commitWork(current: Fiber | null, finishedWork: Fiber): void {
1544
case FunctionComponent:
1545
case ForwardRef:
1546
case MemoComponent:
1552
- case SimpleMemoComponent:
1553
- case Block: {
1547
+ case SimpleMemoComponent: {
1548
// Layout effects are destroyed during the mutation phase so that all
1549
// destroy functions for all fibers are called before any create functions.
1550
// This prevents sibling component effects from interfering with each other,
packages/react-reconciler/src/ReactFiberCompleteWork.new.js
-8
@@ -54,7 +54,6 @@ import {
54
IncompleteClassComponent,
55
FundamentalComponent,
56
ScopeComponent,
57
- Block,
57
OffscreenComponent,
58
LegacyHiddenComponent,
59
} from './ReactWorkTags';
@@ -140,7 +139,6 @@ import {
139
enableSuspenseServerRenderer,
140
enableFundamentalAPI,
141
enableScopeAPI,
143
- enableBlocksAPI,
142
enableProfilerTimer,
143
} from 'shared/ReactFeatureFlags';
144
import {
@@ -1505,12 +1503,6 @@ function completeWork(
1503
}
1504
break;
1505
}
1508
- case Block:
1509
- if (enableBlocksAPI) {
1510
- bubbleProperties(workInProgress);
1511
- return null;
1512
- }
1513
- break;
1506
case OffscreenComponent:
1507
case LegacyHiddenComponent: {
1508
popRenderLanes(workInProgress);
packages/react-reconciler/src/ReactFiberCompleteWork.old.js
-7
@@ -54,7 +54,6 @@ import {
54
IncompleteClassComponent,
55
FundamentalComponent,
56
ScopeComponent,
57
- Block,
57
OffscreenComponent,
58
LegacyHiddenComponent,
59
} from './ReactWorkTags';
@@ -120,7 +119,6 @@ import {
119
enableSuspenseServerRenderer,
120
enableFundamentalAPI,
121
enableScopeAPI,
123
- enableBlocksAPI,
122
enableProfilerTimer,
123
} from 'shared/ReactFeatureFlags';
124
import {
@@ -1256,11 +1254,6 @@ function completeWork(
1254
}
1255
break;
1256
}
1259
- case Block:
1260
- if (enableBlocksAPI) {
1261
- return null;
1262
- }
1263
- break;
1257
case OffscreenComponent:
1258
case LegacyHiddenComponent: {
1259
popRenderLanes(workInProgress);
packages/react-reconciler/src/ReactFiberComponentStack.js
-3
@@ -18,7 +18,6 @@ import {
18
IndeterminateComponent,
19
ForwardRef,
20
SimpleMemoComponent,
21
- Block,
21
ClassComponent,
22
} from './ReactWorkTags';
23
import {
@@ -49,8 +48,6 @@ function describeFiber(fiber: Fiber): string {
48
return describeFunctionComponentFrame(fiber.type, source, owner);
49
case ForwardRef:
50
return describeFunctionComponentFrame(fiber.type.render, source, owner);
52
- case Block:
53
- return describeFunctionComponentFrame(fiber.type._render, source, owner);
51
case ClassComponent:
52
return describeClassComponentFrame(fiber.type, source, owner);
53
default:
packages/react-reconciler/src/ReactFiberWorkLoop.new.js
+2
-5
@@ -110,7 +110,6 @@ import {
110
ForwardRef,
111
MemoComponent,
112
SimpleMemoComponent,
113
- Block,
113
} from './ReactWorkTags';
114
import {LegacyRoot} from './ReactRootTags';
115
import {
@@ -2447,8 +2446,7 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) {
2446
tag !== FunctionComponent &&
2447
tag !== ForwardRef &&
2448
tag !== MemoComponent &&
2450
- tag !== SimpleMemoComponent &&
2451
- tag !== Block
2449
+ tag !== SimpleMemoComponent
2450
) {
2451
// Only warn for user-defined components, not internal ones like Suspense.
2452
return;
@@ -2495,8 +2493,7 @@ function warnAboutUpdateOnUnmountedFiberInDEV(fiber) {
2493
tag !== FunctionComponent &&
2494
tag !== ForwardRef &&
2495
tag !== MemoComponent &&
2498
- tag !== SimpleMemoComponent &&
2499
- tag !== Block
2496
+ tag !== SimpleMemoComponent
2497
) {
2498
// Only warn for user-defined components, not internal ones like Suspense.
2499
return;
packages/react-reconciler/src/ReactFiberWorkLoop.old.js
+2
-5
@@ -108,7 +108,6 @@ import {
108
ForwardRef,
109
MemoComponent,
110
SimpleMemoComponent,
111
- Block,
111
OffscreenComponent,
112
LegacyHiddenComponent,
113
ScopeComponent,
@@ -3006,8 +3005,7 @@ function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) {
3005
tag !== FunctionComponent &&
3006
tag !== ForwardRef &&
3007
tag !== MemoComponent &&
3009
- tag !== SimpleMemoComponent &&
3010
- tag !== Block
3008
+ tag !== SimpleMemoComponent
3009
) {
3010
// Only warn for user-defined components, not internal ones like Suspense.
3011
return;
@@ -3054,8 +3052,7 @@ function warnAboutUpdateOnUnmountedFiberInDEV(fiber) {
3052
tag !== FunctionComponent &&
3053
tag !== ForwardRef &&
3054
tag !== MemoComponent &&
3057
- tag !== SimpleMemoComponent &&
3058
- tag !== Block
3055
+ tag !== SimpleMemoComponent
3056
) {
3057
// Only warn for user-defined components, not internal ones like Suspense.
3058
return;
packages/react-reconciler/src/ReactWorkTags.js
+3
-5
@@ -31,8 +31,7 @@ export type WorkTag =
31
| 20
32
| 21
33
| 22
34
- | 23
35
- | 24;
34
+ | 23;
35
36
export const FunctionComponent = 0;
37
export const ClassComponent = 1;
@@ -56,6 +55,5 @@ export const DehydratedFragment = 18;
55
export const SuspenseListComponent = 19;
56
export const FundamentalComponent = 20;
57
export const ScopeComponent = 21;
59
-export const Block = 22;
60
-export const OffscreenComponent = 23;
61
-export const LegacyHiddenComponent = 24;
58
+export const OffscreenComponent = 22;
59
+export const LegacyHiddenComponent = 23;
packages/react-reconciler/src/__tests__/ReactBlocks-test.js
deleted
-351
@@ -1,351 +0,0 @@
1
-/**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @emails react-core
8
- * @jest-environment node
9
- */
10
-
11
-let React;
12
-let ReactNoop;
13
-let useState;
14
-let Suspense;
15
-let block;
16
-let readString;
17
-let resolvePromises;
18
-let Scheduler;
19
-
20
-describe('ReactBlocks', () => {
21
- beforeEach(() => {
22
- jest.resetModules();
23
-
24
- Scheduler = require('scheduler');
25
- React = require('react');
26
- ReactNoop = require('react-noop-renderer');
27
-
28
- block = React.unstable_block;
29
- useState = React.useState;
30
- Suspense = React.Suspense;
31
- const cache = new Map();
32
- let unresolved = [];
33
- readString = function(text) {
34
- let entry = cache.get(text);
35
- if (!entry) {
36
- entry = {
37
- promise: new Promise(resolve => {
38
- unresolved.push(() => {
39
- entry.resolved = true;
40
- resolve();
41
- });
42
- }),
43
- resolved: false,
44
- };
45
- cache.set(text, entry);
46
- }
47
- if (!entry.resolved) {
48
- throw entry.promise;
49
- }
50
- return text;
51
- };
52
-
53
- resolvePromises = () => {
54
- const res = unresolved;
55
- unresolved = [];
56
- res.forEach(r => r());
57
- };
58
- });
59
-
60
- // @gate experimental
61
- it('renders a simple component', () => {
62
- function User(props, data) {
63
- return <div>{typeof data}</div>;
64
- }
65
-
66
- function App({Component}) {
67
- return (
68
- <Suspense fallback={'Loading...'}>
69
- <Component name="Name" />
70
- </Suspense>
71
- );
72
- }
73
-
74
- const loadUser = block(User);
75
-
76
- ReactNoop.act(() => {
77
- ReactNoop.render(<App Component={loadUser()} />);
78
- });
79
-
80
- expect(ReactNoop).toMatchRenderedOutput(<div>undefined</div>);
81
- });
82
-
83
- // @gate experimental
84
- it('prints the name of the render function in warnings', () => {
85
- function load(firstName) {
86
- return {
87
- name: firstName,
88
- };
89
- }
90
-
91
- function User(props, data) {
92
- const array = [<span>{data.name}</span>];
93
- return <div>{array}</div>;
94
- }
95
-
96
- function App({Component}) {
97
- return (
98
- <Suspense fallback={'Loading...'}>
99
- <Component name="Name" />
100
- </Suspense>
101
- );
102
- }
103
-
104
- const loadUser = block(User, load);
105
-
106
- expect(() => {
107
- ReactNoop.act(() => {
108
- ReactNoop.render(<App Component={loadUser()} />);
109
- });
110
- }).toErrorDev(
111
- 'Warning: Each child in a list should have a unique ' +
112
- '"key" prop.\n\nCheck the render method of `User`. See ' +
113
- 'https://reactjs.org/link/warning-keys for more information.\n' +
114
- ' in span (at **)\n' +
115
- ' in User (at **)\n' +
116
- ' in Suspense (at **)\n' +
117
- ' in App (at **)',
118
- );
119
- });
120
-
121
- // @gate experimental
122
- it('renders a component with a suspending load', async () => {
123
- function load(id) {
124
- return {
125
- id: id,
126
- name: readString('Sebastian'),
127
- };
128
- }
129
-
130
- function Render(props, data) {
131
- return (
132
- <span>
133
- {props.title}: {data.name}
134
- </span>
135
- );
136
- }
137
-
138
- const loadUser = block(Render, load);
139
-
140
- function App({User}) {
141
- return (
142
- <Suspense fallback={'Loading...'}>
143
- <User title="Name" />
144
- </Suspense>
145
- );
146
- }
147
-
148
- await ReactNoop.act(async () => {
149
- ReactNoop.render(<App User={loadUser(123)} />);
150
- });
151
-
152
- expect(ReactNoop).toMatchRenderedOutput('Loading...');
153
-
154
- await ReactNoop.act(async () => {
155
- resolvePromises();
156
- });
157
-
158
- expect(ReactNoop).toMatchRenderedOutput(<span>Name: Sebastian</span>);
159
- });
160
-
161
- // @gate experimental
162
- it('does not support a lazy wrapper around a chunk', async () => {
163
- function load(id) {
164
- return {
165
- id: id,
166
- name: readString('Sebastian'),
167
- };
168
- }
169
-
170
- function Render(props, data) {
171
- return (
172
- <span>
173
- {props.title}: {data.name}
174
- </span>
175
- );
176
- }
177
-
178
- const loadUser = block(Render, load);
179
-
180
- function App({User}) {
181
- return (
182
- <Suspense fallback={'Loading...'}>
183
- <User title="Name" />
184
- </Suspense>
185
- );
186
- }
187
-
188
- let resolveLazy;
189
- const LazyUser = React.lazy(
190
- () =>
191
- new Promise(resolve => {
192
- resolveLazy = function() {
193
- resolve({
194
- default: loadUser(123),
195
- });
196
- };
197
- }),
198
- );
199
-
200
- await ReactNoop.act(async () => {
201
- ReactNoop.render(<App User={LazyUser} />);
202
- });
203
-
204
- expect(ReactNoop).toMatchRenderedOutput('Loading...');
205
-
206
- // Resolve the component.
207
- await resolveLazy();
208
-
209
- expect(Scheduler).toFlushAndThrow(
210
- 'Element type is invalid. Received a promise that resolves to: [object Object]. ' +
211
- 'Lazy element type must resolve to a class or function.' +
212
- (__DEV__
213
- ? ' Did you wrap a component in React.lazy() more than once?'
214
- : ''),
215
- );
216
- });
217
-
218
- // @gate experimental
219
- it('can receive updated data for the same component', async () => {
220
- function load(firstName) {
221
- return {
222
- name: firstName,
223
- };
224
- }
225
-
226
- function Render(props, data) {
227
- const [initialName] = useState(data.name);
228
- return (
229
- <>
230
- <span>Initial name: {initialName}</span>
231
- <span>Latest name: {data.name}</span>
232
- </>
233
- );
234
- }
235
-
236
- const loadUser = block(Render, load);
237
-
238
- function App({User}) {
239
- return (
240
- <Suspense fallback={'Loading...'}>
241
- <User title="Name" />
242
- </Suspense>
243
- );
244
- }
245
-
246
- await ReactNoop.act(async () => {
247
- ReactNoop.render(<App User={loadUser('Sebastian')} />);
248
- });
249
-
250
- expect(ReactNoop).toMatchRenderedOutput(
251
- <>
252
- <span>Initial name: Sebastian</span>
253
- <span>Latest name: Sebastian</span>
254
- </>,
255
- );
256
-
257
- await ReactNoop.act(async () => {
258
- ReactNoop.render(<App User={loadUser('Dan')} />);
259
- });
260
-
261
- expect(ReactNoop).toMatchRenderedOutput(
262
- <>
263
- <span>Initial name: Sebastian</span>
264
- <span>Latest name: Dan</span>
265
- </>,
266
- );
267
- });
268
-
269
- // Regression test.
270
- // @gate experimental
271
- it('does not render stale data after ping', async () => {
272
- function Child() {
273
- return <span>Name: {readString('Sebastian')}</span>;
274
- }
275
-
276
- const loadParent = block(
277
- function Parent(props, data) {
278
- return (
279
- <Suspense fallback="Loading...">
280
- {data.name ? <Child /> : <span>Empty</span>}
281
- </Suspense>
282
- );
283
- },
284
- function load(name) {
285
- return {name};
286
- },
287
- );
288
-
289
- function App({Page}) {
290
- return <Page />;
291
- }
292
-
293
- await ReactNoop.act(async () => {
294
- ReactNoop.render(<App Page={loadParent(null)} />);
295
- });
296
- expect(ReactNoop).toMatchRenderedOutput(<span>Empty</span>);
297
-
298
- await ReactNoop.act(async () => {
299
- ReactNoop.render(<App Page={loadParent('Sebastian')} />);
300
- });
301
- await ReactNoop.act(async () => {
302
- resolvePromises();
303
- });
304
- expect(ReactNoop).toMatchRenderedOutput(<span>Name: Sebastian</span>);
305
- });
306
-
307
- // Regression test.
308
- // @gate experimental
309
- it('does not render stale data after ping and setState', async () => {
310
- function Child() {
311
- return <span>Name: {readString('Sebastian')}</span>;
312
- }
313
-
314
- let _setSuspend;
315
- const loadParent = block(
316
- function Parent(props, data) {
317
- const [suspend, setSuspend] = useState(true);
318
- _setSuspend = setSuspend;
319
- if (!suspend) {
320
- return <span>{data.name}</span>;
321
- }
322
- return (
323
- <Suspense fallback="Loading...">
324
- {data.name ? <Child /> : <span>Empty</span>}
325
- </Suspense>
326
- );
327
- },
328
- function load(name) {
329
- return {name};
330
- },
331
- );
332
-
333
- function App({Page}) {
334
- return <Page />;
335
- }
336
-
337
- await ReactNoop.act(async () => {
338
- ReactNoop.render(<App Page={loadParent(null)} />);
339
- });
340
- expect(ReactNoop).toMatchRenderedOutput(<span>Empty</span>);
341
-
342
- await ReactNoop.act(async () => {
343
- ReactNoop.render(<App Page={loadParent('Sebastian')} />);
344
- });
345
- await ReactNoop.act(async () => {
346
- _setSuspend(false);
347
- resolvePromises();
348
- });
349
- expect(ReactNoop).toMatchRenderedOutput(<span>Sebastian</span>);
350
- });
351
-});
packages/react-server/flight-server-runtime.js
deleted
-10
@@ -1,10 +0,0 @@
1
-/**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-export * from './src/ReactFlightServerRuntime';
packages/react-server/npm/flight-server-runtime.js
deleted
-7
@@ -1,7 +0,0 @@
1
-'use strict';
2
-
3
-if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./cjs/react-server-flight-server-runtime.production.min.js');
5
-} else {
6
- module.exports = require('./cjs/react-server-flight-server-runtime.development.js');
7
-}
packages/react-server/package.json
-1
@@ -14,7 +14,6 @@
14
"README.md",
15
"index.js",
16
"flight.js",
17
- "flight-server-runtime.js",
17
"cjs/"
18
],
19
"main": "index.js",
packages/react-server/src/ReactFlightServer.js
+1
-54
@@ -31,7 +31,6 @@ import {
31
} from './ReactFlightServerConfig';
32
33
import {
34
- REACT_BLOCK_TYPE,
34
REACT_ELEMENT_TYPE,
35
REACT_DEBUG_TRACING_MODE_TYPE,
36
REACT_FORWARD_REF_TYPE,
@@ -42,7 +41,6 @@ import {
41
REACT_OFFSCREEN_TYPE,
42
REACT_PROFILER_TYPE,
43
REACT_SCOPE_TYPE,
45
- REACT_SERVER_BLOCK_TYPE,
44
REACT_STRICT_MODE_TYPE,
45
REACT_SUSPENSE_TYPE,
46
REACT_SUSPENSE_LIST_TYPE,
@@ -138,8 +136,6 @@ function attemptResolveElement(element: React$Element<any>): ReactModel {
136
} else if (typeof type === 'string') {
137
// This is a host element. E.g. HTML.
138
return [REACT_ELEMENT_TYPE, type, element.key, element.props];
141
- } else if (type[0] === REACT_SERVER_BLOCK_TYPE) {
142
- return [REACT_ELEMENT_TYPE, type, element.key, element.props];
139
} else if (
140
type === REACT_FRAGMENT_TYPE ||
141
type === REACT_STRICT_MODE_TYPE ||
@@ -386,62 +382,13 @@ export function resolveModelToJSON(
382
switch (value) {
383
case REACT_ELEMENT_TYPE:
384
return '$';
389
- case REACT_SERVER_BLOCK_TYPE:
390
- return '@';
385
case REACT_LAZY_TYPE:
392
- case REACT_BLOCK_TYPE:
386
invariant(
387
false,
395
- 'React Blocks (and Lazy Components) are expected to be replaced by a ' +
396
- 'compiler on the server. Try configuring your compiler set up and avoid ' +
397
- 'using React.lazy inside of Blocks.',
388
+ 'React Lazy Components are not yet supported on the server.',
389
);
390
}
391
401
- if (parent[0] === REACT_SERVER_BLOCK_TYPE) {
402
- // We're currently encoding part of a Block. Look up which key.
403
- switch (key) {
404
- case '1': {
405
- // Module reference
406
- // Encode as a normal value.
407
- break;
408
- }
409
- case '2': {
410
- // Load function
411
- const load: () => ReactModel = (value: any);
412
- try {
413
- // Attempt to resolve the data.
414
- return load();
415
- } catch (x) {
416
- if (
417
- typeof x === 'object' &&
418
- x !== null &&
419
- typeof x.then === 'function'
420
- ) {
421
- // Something suspended, we'll need to create a new segment and resolve it later.
422
- request.pendingChunks++;
423
- const newSegment = createSegment(request, load);
424
- const ping = newSegment.ping;
425
- x.then(ping, ping);
426
- return serializeByValueID(newSegment.id);
427
- } else {
428
- // This load failed, encode the error as a separate row and reference that.
429
- request.pendingChunks++;
430
- const errorId = request.nextChunkId++;
431
- emitErrorChunk(request, errorId, x);
432
- return serializeByValueID(errorId);
433
- }
434
- }
435
- }
436
- default: {
437
- invariant(
438
- false,
439
- 'A server block should never encode any other slots. This is a bug in React.',
440
- );
441
- }
442
- }
443
- }
444
-
392
// Resolve server components.
393
while (
394
typeof value === 'object' &&
packages/react-server/src/ReactFlightServerRuntime.js
deleted
-52
@@ -1,52 +0,0 @@
1
-/**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-import type {BlockRenderFunction} from 'react/src/ReactBlock';
11
-
12
-import type {ModuleReference} from './ReactFlightServerConfig';
13
-
14
-import {REACT_SERVER_BLOCK_TYPE} from 'shared/ReactSymbols';
15
-
16
-export type ServerBlockComponent<Props, Data> =
17
- | [
18
- Symbol | number,
19
- ModuleReference<BlockRenderFunction<Props, Data>>,
20
- () => Data,
21
- ]
22
- | [Symbol | number, ModuleReference<BlockRenderFunction<Props, void>>];
23
-
24
-opaque type ServerBlock<Props>: React$AbstractComponent<
25
- Props,
26
- null,
27
-> = React$AbstractComponent<Props, null>;
28
-
29
-export function serverBlock<Props, Data>(
30
- moduleReference: ModuleReference<BlockRenderFunction<Props, Data>>,
31
- loadData: () => Data,
32
-): ServerBlock<Props> {
33
- const blockComponent: ServerBlockComponent<Props, Data> = [
34
- REACT_SERVER_BLOCK_TYPE,
35
- moduleReference,
36
- loadData,
37
- ];
38
-
39
- // $FlowFixMe: Upstream BlockComponent to Flow as a valid Node.
40
- return blockComponent;
41
-}
42
-
43
-export function serverBlockNoData<Props>(
44
- moduleReference: ModuleReference<BlockRenderFunction<Props, void>>,
45
-): ServerBlock<Props> {
46
- const blockComponent: ServerBlockComponent<Props, void> = [
47
- REACT_SERVER_BLOCK_TYPE,
48
- moduleReference,
49
- ];
50
- // $FlowFixMe: Upstream BlockComponent to Flow as a valid Node.
51
- return blockComponent;
52
-}
packages/react-test-renderer/src/ReactTestRenderer.js
-10
@@ -39,7 +39,6 @@ import {
39
Profiler,
40
MemoComponent,
41
SimpleMemoComponent,
42
- Block,
42
IncompleteClassComponent,
43
ScopeComponent,
44
} from 'react-reconciler/src/ReactWorkTags';
@@ -195,14 +194,6 @@ function toTree(node: ?Fiber) {
194
instance: null,
195
rendered: childrenToTree(node.child),
196
};
198
- case Block:
199
- return {
200
- nodeType: 'block',
201
- type: node.type,
202
- props: {...node.memoizedProps},
203
- instance: null,
204
- rendered: childrenToTree(node.child),
205
- };
197
case HostComponent: {
198
return {
199
nodeType: 'host',
@@ -240,7 +231,6 @@ const validWrapperTypes = new Set([
231
ForwardRef,
232
MemoComponent,
233
SimpleMemoComponent,
243
- Block,
234
// Normally skipped, but used when there's more than one root child.
235
HostRoot,
236
]);
packages/react-transport-dom-relay/server-runtime.js
deleted
-10
@@ -1,10 +0,0 @@
1
-/**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-export * from 'react-server/src/ReactFlightServerRuntime';
packages/react-transport-dom-relay/src/__tests__/ReactFlightDOMRelay-test.internal.js
-50
@@ -12,7 +12,6 @@ let React;
12
let ReactDOM;
13
let JSResourceReference;
14
let ReactDOMFlightRelayServer;
15
-let ReactDOMFlightRelayServerRuntime;
15
let ReactDOMFlightRelayClient;
16
17
describe('ReactFlightDOMRelay', () => {
@@ -23,7 +22,6 @@ describe('ReactFlightDOMRelay', () => {
22
React = require('react');
23
ReactDOM = require('react-dom');
24
ReactDOMFlightRelayServer = require('react-transport-dom-relay/server');
26
- ReactDOMFlightRelayServerRuntime = require('react-transport-dom-relay/server-runtime');
25
ReactDOMFlightRelayClient = require('react-transport-dom-relay');
26
JSResourceReference = require('JSResourceReference');
27
});
@@ -50,22 +48,6 @@ describe('ReactFlightDOMRelay', () => {
48
return model;
49
}
50
53
- function block(render, load) {
54
- const reference = new JSResourceReference(render);
55
- if (load === undefined) {
56
- return ReactDOMFlightRelayServerRuntime.serverBlock(reference);
57
- }
58
- return function(...args) {
59
- const curriedLoad = () => {
60
- return load(...args);
61
- };
62
- return ReactDOMFlightRelayServerRuntime.serverBlock(
63
- reference,
64
- curriedLoad,
65
- );
66
- };
67
- }
68
-
51
it('can render a server component', () => {
52
function Bar({text}) {
53
return text.toUpperCase();
@@ -134,38 +116,6 @@ describe('ReactFlightDOMRelay', () => {
116
expect(container.innerHTML).toEqual('<span>Hello, Seb Smith</span>');
117
});
118
137
- // @gate experimental
138
- it('can transfer a Block to the client and render there', () => {
139
- function load(firstName, lastName) {
140
- return {name: firstName + ' ' + lastName};
141
- }
142
- function User(props, data) {
143
- return (
144
- <span>
145
- {props.greeting}, {data.name}
146
- </span>
147
- );
148
- }
149
- const loadUser = block(User, load);
150
- const model = {
151
- User: loadUser('Seb', 'Smith'),
152
- };
153
-
154
- const transport = [];
155
- ReactDOMFlightRelayServer.render(model, transport);
156
-
157
- const modelClient = readThrough(transport);
158
-
159
- const container = document.createElement('div');
160
- const root = ReactDOM.createRoot(container);
161
- act(() => {
162
- const UserClient = modelClient.User;
163
- root.render(<UserClient greeting="Hello" />);
164
- });
165
-
166
- expect(container.innerHTML).toEqual('<span>Hello, Seb Smith</span>');
167
- });
168
-
119
// @gate experimental
120
it('can reasonably handle different element types', () => {
121
const {
packages/react-transport-dom-webpack/npm/server-runtime.js
deleted
-7
@@ -1,7 +0,0 @@
1
-'use strict';
2
-
3
-if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./cjs/react-transport-dom-webpack-server-runtime.production.min.js');
5
-} else {
6
- module.exports = require('./cjs/react-transport-dom-webpack-server-runtime.development.js');
7
-}
packages/react-transport-dom-webpack/package.json
-1
@@ -17,7 +17,6 @@
17
"server.js",
18
"server.browser.js",
19
"server.node.js",
20
- "server-runtime.js",
20
"cjs/",
21
"umd/"
22
],
packages/react-transport-dom-webpack/server-runtime.js
deleted
-10
@@ -1,10 +0,0 @@
1
-/**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-export * from 'react-server/src/ReactFlightServerRuntime';
packages/react-transport-dom-webpack/src/__tests__/ReactFlightDOM-test.js
-235
@@ -29,7 +29,6 @@ let Stream;
29
let React;
30
let ReactDOM;
31
let ReactTransportDOMServer;
32
-let ReactTransportDOMServerRuntime;
32
let ReactTransportDOMClient;
33
34
describe('ReactFlightDOM', () => {
@@ -42,7 +41,6 @@ describe('ReactFlightDOM', () => {
41
React = require('react');
42
ReactDOM = require('react-dom');
43
ReactTransportDOMServer = require('react-transport-dom-webpack/server');
45
- ReactTransportDOMServerRuntime = require('react-transport-dom-webpack/server-runtime');
44
ReactTransportDOMClient = require('react-transport-dom-webpack');
45
});
46
@@ -78,25 +76,6 @@ describe('ReactFlightDOM', () => {
76
return {$$typeof: MODULE_TAG, name: 'path/' + idx};
77
}
78
81
- function block(render, load) {
82
- if (load === undefined) {
83
- return () => {
84
- return ReactTransportDOMServerRuntime.serverBlockNoData(
85
- moduleReference(render),
86
- );
87
- };
88
- }
89
- return function(...args) {
90
- const curriedLoad = () => {
91
- return load(...args);
92
- };
93
- return ReactTransportDOMServerRuntime.serverBlock(
94
- moduleReference(render),
95
- curriedLoad,
96
- );
97
- };
98
- }
99
-
79
async function waitForSuspense(fn) {
80
while (true) {
81
try {
@@ -273,220 +252,6 @@ describe('ReactFlightDOM', () => {
252
expect(container.innerHTML).toBe('<p>@div</p>');
253
});
254
276
- // @gate experimental
277
- it('should progressively reveal Blocks', async () => {
278
- const {Suspense} = React;
279
-
280
- class ErrorBoundary extends React.Component {
281
- state = {hasError: false, error: null};
282
- static getDerivedStateFromError(error) {
283
- return {
284
- hasError: true,
285
- error,
286
- };
287
- }
288
- render() {
289
- if (this.state.hasError) {
290
- return this.props.fallback(this.state.error);
291
- }
292
- return this.props.children;
293
- }
294
- }
295
-
296
- // Model
297
- function Text({children}) {
298
- return children;
299
- }
300
- function makeDelayedTextBlock() {
301
- let error, _resolve, _reject;
302
- let promise = new Promise((resolve, reject) => {
303
- _resolve = () => {
304
- promise = null;
305
- resolve();
306
- };
307
- _reject = e => {
308
- error = e;
309
- promise = null;
310
- reject(e);
311
- };
312
- });
313
- function load() {
314
- if (promise) {
315
- throw promise;
316
- }
317
- if (error) {
318
- throw error;
319
- }
320
- return 'data';
321
- }
322
- function DelayedText({children}, data) {
323
- if (data !== 'data') {
324
- throw new Error('No data');
325
- }
326
- return <Text>{children}</Text>;
327
- }
328
- const loadBlock = block(DelayedText, load);
329
- return [loadBlock(), _resolve, _reject];
330
- }
331
-
332
- function makeDelayedText() {
333
- let error, _resolve, _reject;
334
- let promise = new Promise((resolve, reject) => {
335
- _resolve = () => {
336
- promise = null;
337
- resolve();
338
- };
339
- _reject = e => {
340
- error = e;
341
- promise = null;
342
- reject(e);
343
- };
344
- });
345
- function DelayedText({children}, data) {
346
- if (promise) {
347
- throw promise;
348
- }
349
- if (error) {
350
- throw error;
351
- }
352
- return <Text>{children}</Text>;
353
- }
354
- return [DelayedText, _resolve, _reject];
355
- }
356
-
357
- const [FriendsModel, resolveFriendsModel] = makeDelayedText();
358
- const [NameModel, resolveNameModel] = makeDelayedText();
359
- const [PostsModel, resolvePostsModel] = makeDelayedTextBlock();
360
- const [PhotosModel, resolvePhotosModel] = makeDelayedTextBlock();
361
- const [GamesModel, , rejectGamesModel] = makeDelayedTextBlock();
362
- function ProfileMore() {
363
- return {
364
- avatar: <Text>:avatar:</Text>,
365
- friends: <FriendsModel>:friends:</FriendsModel>,
366
- posts: <PostsModel>:posts:</PostsModel>,
367
- games: <GamesModel>:games:</GamesModel>,
368
- };
369
- }
370
- const profileModel = {
371
- photos: <PhotosModel>:photos:</PhotosModel>,
372
- name: <NameModel>:name:</NameModel>,
373
- more: <ProfileMore />,
374
- };
375
-
376
- // View
377
- function ProfileDetails({response}) {
378
- const model = response.readRoot();
379
- return (
380
- <div>
381
- {model.name}
382
- {model.more.avatar}
383
- </div>
384
- );
385
- }
386
- function ProfileSidebar({response}) {
387
- const model = response.readRoot();
388
- return (
389
- <div>
390
- {model.photos}
391
- {model.more.friends}
392
- </div>
393
- );
394
- }
395
- function ProfilePosts({response}) {
396
- return <div>{response.readRoot().more.posts}</div>;
397
- }
398
- function ProfileGames({response}) {
399
- return <div>{response.readRoot().more.games}</div>;
400
- }
401
- function ProfilePage({response}) {
402
- return (
403
- <>
404
- <Suspense fallback={<p>(loading)</p>}>
405
- <ProfileDetails response={response} />
406
- <Suspense fallback={<p>(loading sidebar)</p>}>
407
- <ProfileSidebar response={response} />
408
- </Suspense>
409
- <Suspense fallback={<p>(loading posts)</p>}>
410
- <ProfilePosts response={response} />
411
- </Suspense>
412
- <ErrorBoundary fallback={e => <p>{e.message}</p>}>
413
- <Suspense fallback={<p>(loading games)</p>}>
414
- <ProfileGames response={response} />
415
- </Suspense>
416
- </ErrorBoundary>
417
- </Suspense>
418
- </>
419
- );
420
- }
421
-
422
- const {writable, readable} = getTestStream();
423
- ReactTransportDOMServer.pipeToNodeWritable(
424
- profileModel,
425
- writable,
426
- webpackMap,
427
- );
428
- const response = ReactTransportDOMClient.createFromReadableStream(readable);
429
-
430
- const container = document.createElement('div');
431
- const root = ReactDOM.unstable_createRoot(container);
432
- await act(async () => {
433
- root.render(<ProfilePage response={response} />);
434
- });
435
- expect(container.innerHTML).toBe('<p>(loading)</p>');
436
-
437
- // This isn't enough to show anything.
438
- await act(async () => {
439
- resolveFriendsModel();
440
- });
441
- expect(container.innerHTML).toBe('<p>(loading)</p>');
442
-
443
- // We can now show the details. Sidebar and posts are still loading.
444
- await act(async () => {
445
- resolveNameModel();
446
- });
447
- // Advance time enough to trigger a nested fallback.
448
- jest.advanceTimersByTime(500);
449
- expect(container.innerHTML).toBe(
450
- '<div>:name::avatar:</div>' +
451
- '<p>(loading sidebar)</p>' +
452
- '<p>(loading posts)</p>' +
453
- '<p>(loading games)</p>',
454
- );
455
-
456
- // Let's *fail* loading games.
457
- await act(async () => {
458
- rejectGamesModel(new Error('Game over'));
459
- });
460
- expect(container.innerHTML).toBe(
461
- '<div>:name::avatar:</div>' +
462
- '<p>(loading sidebar)</p>' +
463
- '<p>(loading posts)</p>' +
464
- '<p>Game over</p>', // TODO: should not have message in prod.
465
- );
466
-
467
- // We can now show the sidebar.
468
- await act(async () => {
469
- resolvePhotosModel();
470
- });
471
- expect(container.innerHTML).toBe(
472
- '<div>:name::avatar:</div>' +
473
- '<div>:photos::friends:</div>' +
474
- '<p>(loading posts)</p>' +
475
- '<p>Game over</p>', // TODO: should not have message in prod.
476
- );
477
-
478
- // Show everything.
479
- await act(async () => {
480
- resolvePostsModel();
481
- });
482
- expect(container.innerHTML).toBe(
483
- '<div>:name::avatar:</div>' +
484
- '<div>:photos::friends:</div>' +
485
- '<div>:posts:</div>' +
486
- '<p>Game over</p>', // TODO: should not have message in prod.
487
- );
488
- });
489
-
255
// @gate experimental
256
it('should progressively reveal server components', async () => {
257
const {Suspense} = React;
packages/react/index.classic.fb.js
-3
@@ -50,9 +50,6 @@ export {
50
startTransition as unstable_startTransition,
51
SuspenseList,
52
SuspenseList as unstable_SuspenseList,
53
- // enableBlocksAPI
54
- block,
55
- block as unstable_block,
53
// enableScopeAPI
54
unstable_Scope,
55
unstable_useOpaqueIdentifier,
packages/react/index.experimental.js
-2
@@ -44,8 +44,6 @@ export {
44
useDeferredValue as unstable_useDeferredValue,
45
startTransition as unstable_startTransition,
46
SuspenseList as unstable_SuspenseList,
47
- // enableBlocksAPI
48
- block as unstable_block,
47
unstable_useOpaqueIdentifier,
48
// enableDebugTracing
49
unstable_DebugTracingMode,
packages/react/index.js
-2
@@ -78,8 +78,6 @@ export {
78
useDeferredValue as unstable_useDeferredValue,
79
SuspenseList,
80
SuspenseList as unstable_SuspenseList,
81
- block,
82
- block as unstable_block,
81
unstable_LegacyHidden,
82
unstable_createFundamental,
83
unstable_Scope,
packages/react/index.modern.fb.js
-3
@@ -49,9 +49,6 @@ export {
49
startTransition as unstable_startTransition,
50
SuspenseList,
51
SuspenseList as unstable_SuspenseList,
52
- // enableBlocksAPI
53
- block,
54
- block as unstable_block,
52
// enableScopeAPI
53
unstable_Scope,
54
unstable_useOpaqueIdentifier,
packages/react/src/React.js
-3
@@ -32,7 +32,6 @@ import {createContext} from './ReactContext';
32
import {lazy} from './ReactLazy';
33
import {forwardRef} from './ReactForwardRef';
34
import {memo} from './ReactMemo';
35
-import {block} from './ReactBlock';
35
import {
36
useCallback,
37
useContext,
@@ -111,8 +110,6 @@ export {
110
useDeferredValue,
111
REACT_SUSPENSE_LIST_TYPE as SuspenseList,
112
REACT_LEGACY_HIDDEN_TYPE as unstable_LegacyHidden,
114
- // enableBlocksAPI
115
- block,
113
// enableFundamentalAPI
114
createFundamental as unstable_createFundamental,
115
// enableScopeAPI
packages/react/src/ReactBlock.js
deleted
-138
@@ -1,138 +0,0 @@
1
-/**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow
8
- */
9
-
10
-import type {LazyComponent} from './ReactLazy';
11
-
12
-import {
13
- REACT_LAZY_TYPE,
14
- REACT_BLOCK_TYPE,
15
- REACT_MEMO_TYPE,
16
- REACT_FORWARD_REF_TYPE,
17
-} from 'shared/ReactSymbols';
18
-
19
-type BlockLoadFunction<Args: Iterable<any>, Data> = (...args: Args) => Data;
20
-export type BlockRenderFunction<Props, Data> = (
21
- props: Props,
22
- data: Data,
23
-) => React$Node;
24
-
25
-type Payload<Props, Args: Iterable<any>, Data> = {
26
- load: BlockLoadFunction<Args, Data>,
27
- args: Args,
28
- render: BlockRenderFunction<Props, Data>,
29
-};
30
-
31
-export type BlockComponent<Props, Data> = {
32
- $$typeof: Symbol | number,
33
- _data: Data,
34
- _render: BlockRenderFunction<Props, Data>,
35
-};
36
-
37
-opaque type Block<Props>: React$AbstractComponent<
38
- Props,
39
- null,
40
-> = React$AbstractComponent<Props, null>;
41
-
42
-function lazyInitializer<Props, Args: Iterable<any>, Data>(
43
- payload: Payload<Props, Args, Data>,
44
-): BlockComponent<Props, Data> {
45
- return {
46
- $$typeof: REACT_BLOCK_TYPE,
47
- _data: payload.load.apply(null, payload.args),
48
- _render: payload.render,
49
- };
50
-}
51
-
52
-export function block<Args: Iterable<any>, Props, Data>(
53
- render: BlockRenderFunction<Props, Data>,
54
- load?: BlockLoadFunction<Args, Data>,
55
-): (...args: Args) => Block<Props> {
56
- if (__DEV__) {
57
- if (load !== undefined && typeof load !== 'function') {
58
- console.error(
59
- 'Blocks require a load function, if provided, but was given %s.',
60
- load === null ? 'null' : typeof load,
61
- );
62
- }
63
- if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
64
- console.error(
65
- 'Blocks require a render function but received a `memo` ' +
66
- 'component. Use `memo` on an inner component instead.',
67
- );
68
- } else if (render != null && render.$$typeof === REACT_FORWARD_REF_TYPE) {
69
- console.error(
70
- 'Blocks require a render function but received a `forwardRef` ' +
71
- 'component. Use `forwardRef` on an inner component instead.',
72
- );
73
- } else if (typeof render !== 'function') {
74
- console.error(
75
- 'Blocks require a render function but was given %s.',
76
- render === null ? 'null' : typeof render,
77
- );
78
- } else if (render.length !== 0 && render.length !== 2) {
79
- // Warn if it's not accepting two args.
80
- // Do not warn for 0 arguments because it could be due to usage of the 'arguments' object.
81
- console.error(
82
- 'Block render functions accept exactly two parameters: props and data. %s',
83
- render.length === 1
84
- ? 'Did you forget to use the data parameter?'
85
- : 'Any additional parameter will be undefined.',
86
- );
87
- }
88
-
89
- if (
90
- render != null &&
91
- (render.defaultProps != null || render.propTypes != null)
92
- ) {
93
- console.error(
94
- 'Block render functions do not support propTypes or defaultProps. ' +
95
- 'Did you accidentally pass a React component?',
96
- );
97
- }
98
- }
99
-
100
- if (load === undefined) {
101
- return function(): Block<Props> {
102
- const blockComponent: BlockComponent<Props, void> = {
103
- $$typeof: REACT_BLOCK_TYPE,
104
- _data: undefined,
105
- // $FlowFixMe: Data must be void in this scenario.
106
- _render: render,
107
- };
108
-
109
- // $FlowFixMe: Upstream BlockComponent to Flow as a valid Node.
110
- return blockComponent;
111
- };
112
- }
113
-
114
- // Trick to let Flow refine this.
115
- const loadFn = load;
116
-
117
- return function(): Block<Props> {
118
- const args: Args = arguments;
119
-
120
- const payload: Payload<Props, Args, Data> = {
121
- load: loadFn,
122
- args: args,
123
- render: render,
124
- };
125
-
126
- const lazyType: LazyComponent<
127
- BlockComponent<Props, Data>,
128
- Payload<Props, Args, Data>,
129
- > = {
130
- $$typeof: REACT_LAZY_TYPE,
131
- _payload: payload,
132
- _init: lazyInitializer,
133
- };
134
-
135
- // $FlowFixMe: Upstream BlockComponent to Flow as a valid Node.
136
- return lazyType;
137
- };
138
-}
packages/shared/ReactComponentStackFrame.js
-3
@@ -17,7 +17,6 @@ import {
17
REACT_SUSPENSE_LIST_TYPE,
18
REACT_FORWARD_REF_TYPE,
19
REACT_MEMO_TYPE,
20
- REACT_BLOCK_TYPE,
20
REACT_LAZY_TYPE,
21
} from 'shared/ReactSymbols';
22
@@ -301,8 +300,6 @@ export function describeUnknownElementTypeFrameInDEV(
300
case REACT_MEMO_TYPE:
301
// Memo may contain any component type so we recursively resolve it.
302
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
304
- case REACT_BLOCK_TYPE:
305
- return describeFunctionComponentFrame(type._render, source, ownerFn);
303
case REACT_LAZY_TYPE: {
304
const lazyComponent: LazyComponent<any, any> = (type: any);
305
const payload = lazyComponent._payload;
packages/shared/ReactFeatureFlags.js
-1
@@ -44,7 +44,6 @@ export const enableSuspenseServerRenderer = __EXPERIMENTAL__;
44
export const enableSelectiveHydration = __EXPERIMENTAL__;
45
46
// Flight experiments
47
-export const enableBlocksAPI = __EXPERIMENTAL__;
47
export const enableLazyElements = __EXPERIMENTAL__;
48
49
// Only used in www builds.
packages/shared/ReactSymbols.js
-4
@@ -25,8 +25,6 @@ export let REACT_SUSPENSE_TYPE = 0xead1;
25
export let REACT_SUSPENSE_LIST_TYPE = 0xead8;
26
export let REACT_MEMO_TYPE = 0xead3;
27
export let REACT_LAZY_TYPE = 0xead4;
28
-export let REACT_BLOCK_TYPE = 0xead9;
29
-export let REACT_SERVER_BLOCK_TYPE = 0xeada;
28
export let REACT_FUNDAMENTAL_TYPE = 0xead5;
29
export let REACT_SCOPE_TYPE = 0xead7;
30
export let REACT_OPAQUE_ID_TYPE = 0xeae0;
@@ -48,8 +46,6 @@ if (typeof Symbol === 'function' && Symbol.for) {
46
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
47
REACT_MEMO_TYPE = symbolFor('react.memo');
48
REACT_LAZY_TYPE = symbolFor('react.lazy');
51
- REACT_BLOCK_TYPE = symbolFor('react.block');
52
- REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
49
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
50
REACT_SCOPE_TYPE = symbolFor('react.scope');
51
REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
packages/shared/forks/ReactFeatureFlags.native-fb.js
-1
@@ -18,7 +18,6 @@ export const enableProfilerCommitHooks = false;
18
export const enableSchedulerTracing = __PROFILE__;
19
export const enableSuspenseServerRenderer = false;
20
export const enableSelectiveHydration = false;
21
-export const enableBlocksAPI = false;
21
export const enableLazyElements = false;
22
export const enableSchedulerDebugging = false;
23
export const debugRenderPhaseSideEffectsForStrictMode = true;
packages/shared/forks/ReactFeatureFlags.native-oss.js
-1
@@ -20,7 +20,6 @@ export const enableProfilerCommitHooks = false;
20
export const enableSchedulerTracing = __PROFILE__;
21
export const enableSuspenseServerRenderer = false;
22
export const enableSelectiveHydration = false;
23
-export const enableBlocksAPI = false;
23
export const enableLazyElements = false;
24
export const disableJavaScriptURLs = false;
25
export const disableInputAttributeSyncing = false;
packages/shared/forks/ReactFeatureFlags.test-renderer.js
-1
@@ -20,7 +20,6 @@ export const enableProfilerCommitHooks = false;
20
export const enableSchedulerTracing = __PROFILE__;
21
export const enableSuspenseServerRenderer = false;
22
export const enableSelectiveHydration = false;
23
-export const enableBlocksAPI = false;
23
export const enableLazyElements = false;
24
export const disableJavaScriptURLs = false;
25
export const disableInputAttributeSyncing = false;
packages/shared/forks/ReactFeatureFlags.test-renderer.native.js
-1
@@ -20,7 +20,6 @@ export const enableProfilerCommitHooks = false;
20
export const enableSchedulerTracing = __PROFILE__;
21
export const enableSuspenseServerRenderer = false;
22
export const enableSelectiveHydration = false;
23
-export const enableBlocksAPI = false;
23
export const enableLazyElements = false;
24
export const disableJavaScriptURLs = false;
25
export const disableInputAttributeSyncing = false;
packages/shared/forks/ReactFeatureFlags.test-renderer.www.js
-1
@@ -20,7 +20,6 @@ export const enableProfilerCommitHooks = false;
20
export const enableSchedulerTracing = __PROFILE__;
21
export const enableSuspenseServerRenderer = false;
22
export const enableSelectiveHydration = false;
23
-export const enableBlocksAPI = false;
23
export const enableLazyElements = false;
24
export const enableSchedulerDebugging = false;
25
export const disableJavaScriptURLs = false;
packages/shared/forks/ReactFeatureFlags.testing.js
-1
@@ -20,7 +20,6 @@ export const enableProfilerCommitHooks = false;
20
export const enableSchedulerTracing = __PROFILE__;
21
export const enableSuspenseServerRenderer = false;
22
export const enableSelectiveHydration = false;
23
-export const enableBlocksAPI = false;
23
export const enableLazyElements = false;
24
export const disableJavaScriptURLs = false;
25
export const disableInputAttributeSyncing = false;
packages/shared/forks/ReactFeatureFlags.testing.www.js
-1
@@ -20,7 +20,6 @@ export const enableProfilerCommitHooks = false;
20
export const enableSchedulerTracing = false;
21
export const enableSuspenseServerRenderer = true;
22
export const enableSelectiveHydration = true;
23
-export const enableBlocksAPI = true;
23
export const enableLazyElements = false;
24
export const disableJavaScriptURLs = true;
25
export const disableInputAttributeSyncing = false;
packages/shared/forks/ReactFeatureFlags.www.js
-1
@@ -54,7 +54,6 @@ export const warnAboutDefaultPropsOnFunctionComponents = false;
54
export const enableSuspenseServerRenderer = true;
55
export const enableSelectiveHydration = true;
56
57
-export const enableBlocksAPI = true;
57
export const enableLazyElements = true;
58
59
export const disableJavaScriptURLs = true;
packages/shared/getComponentName.js
-3
@@ -21,7 +21,6 @@ import {
21
REACT_SUSPENSE_TYPE,
22
REACT_SUSPENSE_LIST_TYPE,
23
REACT_LAZY_TYPE,
24
- REACT_BLOCK_TYPE,
24
} from 'shared/ReactSymbols';
25
import type {ReactContext, ReactProviderType} from 'shared/ReactTypes';
26
@@ -86,8 +85,6 @@ function getComponentName(type: mixed): string | null {
85
return getWrappedName(type, type.render, 'ForwardRef');
86
case REACT_MEMO_TYPE:
87
return getComponentName(type.type);
89
- case REACT_BLOCK_TYPE:
90
- return getComponentName(type._render);
88
case REACT_LAZY_TYPE: {
89
const lazyComponent: LazyComponent<any, any> = (type: any);
90
const payload = lazyComponent._payload;
packages/shared/isValidElementType.js
+1
-5
@@ -21,8 +21,6 @@ import {
21
REACT_LAZY_TYPE,
22
REACT_FUNDAMENTAL_TYPE,
23
REACT_SCOPE_TYPE,
24
- REACT_BLOCK_TYPE,
25
- REACT_SERVER_BLOCK_TYPE,
24
REACT_LEGACY_HIDDEN_TYPE,
25
} from 'shared/ReactSymbols';
26
import {enableScopeAPI} from './ReactFeatureFlags';
@@ -64,9 +62,7 @@ export default function isValidElementType(type: mixed) {
62
// we don't know which Flight build this will end up being used
63
// with.
64
type.$$typeof === REACT_MODULE_REFERENCE ||
67
- type.getModuleId !== undefined ||
68
- type.$$typeof === REACT_BLOCK_TYPE ||
69
- type[(0: any)] === REACT_SERVER_BLOCK_TYPE
65
+ type.getModuleId !== undefined
66
) {
67
return true;
68
}
scripts/error-codes/codes.json
+1
-1
@@ -341,7 +341,7 @@
341
"349": "Expected a work-in-progress root. This is a bug in React. Please file an issue.",
342
"350": "Cannot read from mutable source during the current render without tearing. This is a bug in React. Please file an issue.",
343
"351": "Unsupported server component type: %s",
344
- "352": "React Blocks (and Lazy Components) are expected to be replaced by a compiler on the server. Try configuring your compiler set up and avoid using React.lazy inside of Blocks.",
344
+ "352": "React Lazy Components are not yet supported on the server.",
345
"353": "A server block should never encode any other slots. This is a bug in React.",
346
"354": "getInspectorDataForViewAtPoint() is not available in production.",
347
"355": "The object passed back from useOpaqueIdentifier is meant to be passed through to attributes only. Do not read the value directly.",
scripts/jest/TestFlags.js
+3
-3
@@ -4,7 +4,7 @@
4
// certain conditions. They're like GKs.
5
//
6
// Examples:
7
-// // @gate enableBlocksAPI
7
+// // @gate enableSomeAPI
8
// test('uses an unstable API', () => {/*...*/})
9
//
10
// // @gate __DEV__
@@ -18,12 +18,12 @@
18
//
19
// You can also combine flags using multiple gates:
20
//
21
-// // @gate enableBlocksAPI
21
+// // @gate enableSomeAPI
22
// // @gate __DEV__
23
// test('both conditions must pass', () => {/*...*/})
24
//
25
// Or using logical operators
26
-// // @gate enableBlocksAPI && __DEV__
26
+// // @gate enableSomeAPI && __DEV__
27
// test('both conditions must pass', () => {/*...*/})
28
//
29
// Negation also works:
scripts/rollup/bundles.js
-25
@@ -265,13 +265,6 @@ const bundles = [
265
global: 'ReactTransportDOMServer',
266
externals: ['react', 'react-dom/server'],
267
},
268
- {
269
- bundleTypes: [NODE_DEV, NODE_PROD],
270
- moduleType: RENDERER,
271
- entry: 'react-transport-dom-webpack/server-runtime',
272
- global: 'ReactTransportDOMServerRuntime',
273
- externals: ['react'],
274
- },
268
269
/******* React Transport DOM Client Webpack *******/
270
{
@@ -304,17 +297,6 @@ const bundles = [
297
'JSResourceReference',
298
],
299
},
307
- {
308
- bundleTypes: [FB_WWW_DEV, FB_WWW_PROD],
309
- moduleType: RENDERER,
310
- entry: 'react-transport-dom-relay/server-runtime',
311
- global: 'ReactFlightDOMRelayServerRuntime',
312
- externals: [
313
- 'react',
314
- 'ReactFlightDOMRelayServerIntegration',
315
- 'JSResourceReference',
316
- ],
317
- },
300
301
/******* React DOM Flight Client Relay *******/
302
{
@@ -521,13 +503,6 @@ const bundles = [
503
global: 'ReactFlightServer',
504
externals: ['react'],
505
},
524
- {
525
- bundleTypes: [NODE_DEV, NODE_PROD],
526
- moduleType: RENDERER,
527
- entry: 'react-server/flight-server-runtime',
528
- global: 'ReactFlightServerRuntime',
529
- externals: ['react'],
530
- },
506
507
/******* React Flight Client *******/
508
{
scripts/shared/inlinedHostConfigs.js
-7
@@ -14,7 +14,6 @@ module.exports = [
14
'react-dom/testing',
15
'react-dom/unstable-fizz.node',
16
'react-transport-dom-webpack/server.node',
17
- 'react-transport-dom-webpack/server-runtime',
17
'react-transport-dom-webpack',
18
],
19
paths: [
@@ -25,7 +24,6 @@ module.exports = [
24
'react-transport-dom-webpack',
25
'react-transport-dom-webpack/server',
26
'react-transport-dom-webpack/server.node',
28
- 'react-transport-dom-webpack/server-runtime',
27
'react-transport-dom-webpack/src/ReactFlightDOMServerNode.js', // react-transport-dom-webpack/server.browser
28
'react-client/src/ReactFlightClientStream.js', // We can only type check this in streaming configurations.
29
'react-interactions',
@@ -40,7 +38,6 @@ module.exports = [
38
'react-dom/testing',
39
'react-dom/unstable-fizz.browser',
40
'react-transport-dom-webpack/server.browser',
43
- 'react-transport-dom-webpack/server-runtime',
41
'react-transport-dom-webpack',
42
],
43
paths: [
@@ -50,7 +47,6 @@ module.exports = [
47
'react-dom/src/server/ReactDOMFizzServerBrowser.js', // react-dom/unstable-fizz.browser
48
'react-transport-dom-webpack',
49
'react-transport-dom-webpack/server.browser',
53
- 'react-transport-dom-webpack/server-runtime',
50
'react-transport-dom-webpack/src/ReactFlightDOMServerBrowser.js', // react-transport-dom-webpack/server.browser
51
'react-client/src/ReactFlightClientStream.js', // We can only type check this in streaming configurations.
52
],
@@ -90,7 +86,6 @@ module.exports = [
86
entryPoints: [
87
'react-transport-dom-relay',
88
'react-transport-dom-relay/server',
93
- 'react-transport-dom-relay/server-runtime',
89
],
90
paths: ['react-dom', 'react-transport-dom-relay'],
91
isFlowTyped: true,
@@ -103,12 +98,10 @@ module.exports = [
98
'react-client/flight',
99
'react-server',
100
'react-server/flight',
106
- 'react-server/flight-server-runtime',
101
],
102
paths: [
103
'react-client/flight',
104
'react-server/flight',
111
- 'react-server/flight-server-runtime',
105
'react-client/src/ReactFlightClientStream.js', // We can only type check this in streaming configurations.
106
],
107
isFlowTyped: true,