From 49130aa481b5744c8a74d302cf120e83c69bc6b6 Mon Sep 17 00:00:00 2001 From: Sebastian Markbage Date: Wed, 19 Feb 2020 19:42:00 -0800 Subject: [PATCH] Rename Chunks API to Blocks Sounds like this is the name we're going with. This also helps us distinguish it from other "chunking" implementation details. --- .../react-debug-tools/src/ReactDebugHooks.js | 4 +-- .../react-reconciler/src/ReactChildFiber.js | 20 ++++++------- packages/react-reconciler/src/ReactFiber.js | 16 +++++------ .../src/ReactFiberBeginWork.js | 28 +++++++++---------- .../src/ReactFiberCommitWork.js | 14 +++++----- .../src/ReactFiberCompleteWork.js | 8 +++--- .../src/ReactFiberWorkLoop.js | 4 +-- ...eactChunks-test.js => ReactBlocks-test.js} | 12 ++++---- .../src/ReactTestRenderer.js | 8 +++--- packages/react/src/React.js | 8 +++--- packages/react/src/{chunk.js => block.js} | 24 ++++++++-------- packages/shared/ReactFeatureFlags.js | 2 +- packages/shared/ReactSymbols.js | 2 +- packages/shared/ReactWorkTags.js | 2 +- .../forks/ReactFeatureFlags.native-fb.js | 2 +- .../forks/ReactFeatureFlags.native-oss.js | 2 +- .../forks/ReactFeatureFlags.persistent.js | 2 +- .../forks/ReactFeatureFlags.test-renderer.js | 2 +- .../ReactFeatureFlags.test-renderer.www.js | 2 +- .../shared/forks/ReactFeatureFlags.testing.js | 2 +- .../forks/ReactFeatureFlags.testing.www.js | 2 +- .../shared/forks/ReactFeatureFlags.www.js | 2 +- packages/shared/getComponentName.js | 4 +-- packages/shared/isValidElementType.js | 4 +-- 24 files changed, 88 insertions(+), 88 deletions(-) rename packages/react-reconciler/src/__tests__/{ReactChunks-test.js => ReactBlocks-test.js} (95%) rename packages/react/src/{chunk.js => block.js} (74%) diff --git a/packages/react-debug-tools/src/ReactDebugHooks.js b/packages/react-debug-tools/src/ReactDebugHooks.js index 99f7ae89056f7..d515bac08e9b9 100644 --- a/packages/react-debug-tools/src/ReactDebugHooks.js +++ b/packages/react-debug-tools/src/ReactDebugHooks.js @@ -25,7 +25,7 @@ import { SimpleMemoComponent, ContextProvider, ForwardRef, - Chunk, + Block, } from 'shared/ReactWorkTags'; type CurrentDispatcherRef = typeof ReactSharedInternals.ReactCurrentDispatcher; @@ -628,7 +628,7 @@ export function inspectHooksOfFiber( fiber.tag !== FunctionComponent && fiber.tag !== SimpleMemoComponent && fiber.tag !== ForwardRef && - fiber.tag !== Chunk + fiber.tag !== Block ) { throw new Error( 'Unknown Fiber. Needs to be a function component to inspect hooks.', diff --git a/packages/react-reconciler/src/ReactChildFiber.js b/packages/react-reconciler/src/ReactChildFiber.js index f5203c7e0db39..e17fa1e73e88c 100644 --- a/packages/react-reconciler/src/ReactChildFiber.js +++ b/packages/react-reconciler/src/ReactChildFiber.js @@ -19,7 +19,7 @@ import { REACT_ELEMENT_TYPE, REACT_FRAGMENT_TYPE, REACT_PORTAL_TYPE, - REACT_CHUNK_TYPE, + REACT_BLOCK_TYPE, } from 'shared/ReactSymbols'; import { FunctionComponent, @@ -27,10 +27,10 @@ import { HostText, HostPortal, Fragment, - Chunk, + Block, } from 'shared/ReactWorkTags'; import invariant from 'shared/invariant'; -import {warnAboutStringRefs, enableChunksAPI} from 'shared/ReactFeatureFlags'; +import {warnAboutStringRefs, enableBlocksAPI} from 'shared/ReactFeatureFlags'; import { createWorkInProgress, @@ -420,9 +420,9 @@ function ChildReconciler(shouldTrackSideEffects) { } return existing; } else if ( - enableChunksAPI && - current.tag === Chunk && - element.type.$$typeof === REACT_CHUNK_TYPE && + enableBlocksAPI && + current.tag === Block && + element.type.$$typeof === REACT_BLOCK_TYPE && element.type.render === current.type.render ) { // Same as above but also update the .type field. @@ -1183,10 +1183,10 @@ function ChildReconciler(shouldTrackSideEffects) { } break; } - case Chunk: - if (enableChunksAPI) { + case Block: + if (enableBlocksAPI) { if ( - element.type.$$typeof === REACT_CHUNK_TYPE && + element.type.$$typeof === REACT_BLOCK_TYPE && element.type.render === child.type.render ) { deleteRemainingChildren(returnFiber, child.sibling); @@ -1200,7 +1200,7 @@ function ChildReconciler(shouldTrackSideEffects) { return existing; } } - // We intentionally fallthrough here if enableChunksAPI is not on. + // We intentionally fallthrough here if enableBlocksAPI is not on. // eslint-disable-next-lined no-fallthrough default: { if ( diff --git a/packages/react-reconciler/src/ReactFiber.js b/packages/react-reconciler/src/ReactFiber.js index a51116219927f..bc04af44d8d10 100644 --- a/packages/react-reconciler/src/ReactFiber.js +++ b/packages/react-reconciler/src/ReactFiber.js @@ -33,7 +33,7 @@ import { enableFundamentalAPI, enableUserTimingAPI, enableScopeAPI, - enableChunksAPI, + enableBlocksAPI, } from 'shared/ReactFeatureFlags'; import {NoEffect, Placement} from 'shared/ReactSideEffectTags'; import {ConcurrentRoot, BlockingRoot} from 'shared/ReactRootTags'; @@ -59,7 +59,7 @@ import { LazyComponent, FundamentalComponent, ScopeComponent, - Chunk, + Block, } from 'shared/ReactWorkTags'; import getComponentName from 'shared/getComponentName'; @@ -91,7 +91,7 @@ import { REACT_LAZY_TYPE, REACT_FUNDAMENTAL_TYPE, REACT_SCOPE_TYPE, - REACT_CHUNK_TYPE, + REACT_BLOCK_TYPE, } from 'shared/ReactSymbols'; let hasBadMapPolyfill; @@ -391,9 +391,9 @@ export function resolveLazyComponentTag(Component: Function): WorkTag { if ($$typeof === REACT_MEMO_TYPE) { return MemoComponent; } - if (enableChunksAPI) { - if ($$typeof === REACT_CHUNK_TYPE) { - return Chunk; + if (enableBlocksAPI) { + if ($$typeof === REACT_BLOCK_TYPE) { + return Block; } } } @@ -680,8 +680,8 @@ export function createFiberFromTypeAndProps( fiberTag = LazyComponent; resolvedType = null; break getTag; - case REACT_CHUNK_TYPE: - fiberTag = Chunk; + case REACT_BLOCK_TYPE: + fiberTag = Block; break getTag; case REACT_FUNDAMENTAL_TYPE: if (enableFundamentalAPI) { diff --git a/packages/react-reconciler/src/ReactFiberBeginWork.js b/packages/react-reconciler/src/ReactFiberBeginWork.js index 9db5886a6c2b4..32a4d4fba96e8 100644 --- a/packages/react-reconciler/src/ReactFiberBeginWork.js +++ b/packages/react-reconciler/src/ReactFiberBeginWork.js @@ -42,7 +42,7 @@ import { IncompleteClassComponent, FundamentalComponent, ScopeComponent, - Chunk, + Block, } from 'shared/ReactWorkTags'; import { NoEffect, @@ -65,7 +65,7 @@ import { enableFundamentalAPI, warnAboutDefaultPropsOnFunctionComponents, enableScopeAPI, - enableChunksAPI, + enableBlocksAPI, } from 'shared/ReactFeatureFlags'; import invariant from 'shared/invariant'; import shallowEqual from 'shared/shallowEqual'; @@ -691,10 +691,10 @@ function updateFunctionComponent( return workInProgress.child; } -function updateChunk( +function updateBlock( current: Fiber | null, workInProgress: Fiber, - chunk: any, + block: any, nextProps: any, renderExpirationTime: ExpirationTime, ) { @@ -702,8 +702,8 @@ function updateChunk( // hasn't yet mounted. This happens after the first render suspends. // We'll need to figure out if this is fine or can cause issues. - const render = chunk.render; - const data = chunk.query(); + const render = block.render; + const data = block.query(); // The rest is a fork of updateFunctionComponent let nextChildren; @@ -1210,10 +1210,10 @@ function mountLazyComponent( ); return child; } - case Chunk: { - if (enableChunksAPI) { + case Block: { + if (enableBlocksAPI) { // TODO: Resolve for Hot Reloading. - child = updateChunk( + child = updateBlock( null, workInProgress, Component, @@ -3287,14 +3287,14 @@ function beginWork( } break; } - case Chunk: { - if (enableChunksAPI) { - const chunk = workInProgress.type; + case Block: { + if (enableBlocksAPI) { + const block = workInProgress.type; const props = workInProgress.pendingProps; - return updateChunk( + return updateBlock( current, workInProgress, - chunk, + block, props, renderExpirationTime, ); diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.js b/packages/react-reconciler/src/ReactFiberCommitWork.js index ba682cc93f53c..bc1f1054e3723 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.js @@ -53,7 +53,7 @@ import { SuspenseListComponent, FundamentalComponent, ScopeComponent, - Chunk, + Block, } from 'shared/ReactWorkTags'; import { invokeGuardedCallback, @@ -249,7 +249,7 @@ function commitBeforeMutationLifeCycles( case FunctionComponent: case ForwardRef: case SimpleMemoComponent: - case Chunk: { + case Block: { return; } case ClassComponent: { @@ -426,7 +426,7 @@ export function commitPassiveHookEffects(finishedWork: Fiber): void { case FunctionComponent: case ForwardRef: case SimpleMemoComponent: - case Chunk: { + case Block: { // TODO (#17945) We should call all passive destroy functions (for all fibers) // before calling any create functions. The current approach only serializes // these for a single fiber. @@ -450,7 +450,7 @@ function commitLifeCycles( case FunctionComponent: case ForwardRef: case SimpleMemoComponent: - case Chunk: { + case Block: { // At this point layout effects have already been destroyed (during mutation phase). // This is done to prevent sibling component effects from interfering with each other, // e.g. a destroy function in one component should never override a ref set @@ -789,7 +789,7 @@ function commitUnmount( case ForwardRef: case MemoComponent: case SimpleMemoComponent: - case Chunk: { + case Block: { const updateQueue: FunctionComponentUpdateQueue | null = (current.updateQueue: any); if (updateQueue !== null) { const lastEffect = updateQueue.lastEffect; @@ -1370,7 +1370,7 @@ function commitWork(current: Fiber | null, finishedWork: Fiber): void { case ForwardRef: case MemoComponent: case SimpleMemoComponent: - case Chunk: { + case Block: { // Layout effects are destroyed during the mutation phase so that all // destroy functions for all fibers are called before any create functions. // This prevents sibling component effects from interfering with each other, @@ -1413,7 +1413,7 @@ function commitWork(current: Fiber | null, finishedWork: Fiber): void { case ForwardRef: case MemoComponent: case SimpleMemoComponent: - case Chunk: { + case Block: { // Layout effects are destroyed during the mutation phase so that all // destroy functions for all fibers are called before any create functions. // This prevents sibling component effects from interfering with each other, diff --git a/packages/react-reconciler/src/ReactFiberCompleteWork.js b/packages/react-reconciler/src/ReactFiberCompleteWork.js index 1138dc57116b9..e7ecaf3343b82 100644 --- a/packages/react-reconciler/src/ReactFiberCompleteWork.js +++ b/packages/react-reconciler/src/ReactFiberCompleteWork.js @@ -51,7 +51,7 @@ import { IncompleteClassComponent, FundamentalComponent, ScopeComponent, - Chunk, + Block, } from 'shared/ReactWorkTags'; import {NoMode, BlockingMode} from './ReactTypeOfMode'; import { @@ -119,7 +119,7 @@ import { enableDeprecatedFlareAPI, enableFundamentalAPI, enableScopeAPI, - enableChunksAPI, + enableBlocksAPI, } from 'shared/ReactFeatureFlags'; import { markSpawnedWork, @@ -1295,8 +1295,8 @@ function completeWork( } break; } - case Chunk: - if (enableChunksAPI) { + case Block: + if (enableBlocksAPI) { return null; } break; diff --git a/packages/react-reconciler/src/ReactFiberWorkLoop.js b/packages/react-reconciler/src/ReactFiberWorkLoop.js index 31946efd199bd..d7820eda85b83 100644 --- a/packages/react-reconciler/src/ReactFiberWorkLoop.js +++ b/packages/react-reconciler/src/ReactFiberWorkLoop.js @@ -88,7 +88,7 @@ import { ForwardRef, MemoComponent, SimpleMemoComponent, - Chunk, + Block, } from 'shared/ReactWorkTags'; import { NoEffect, @@ -2682,7 +2682,7 @@ function warnAboutUpdateOnUnmountedFiberInDEV(fiber) { tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent && - tag !== Chunk + tag !== Block ) { // Only warn for user-defined components, not internal ones like Suspense. return; diff --git a/packages/react-reconciler/src/__tests__/ReactChunks-test.js b/packages/react-reconciler/src/__tests__/ReactBlocks-test.js similarity index 95% rename from packages/react-reconciler/src/__tests__/ReactChunks-test.js rename to packages/react-reconciler/src/__tests__/ReactBlocks-test.js index 28ed482ebdb84..280eef0609a14 100644 --- a/packages/react-reconciler/src/__tests__/ReactChunks-test.js +++ b/packages/react-reconciler/src/__tests__/ReactBlocks-test.js @@ -12,17 +12,17 @@ let React; let ReactNoop; let useState; let Suspense; -let chunk; +let block; let readString; -describe('ReactChunks', () => { +describe('ReactBlocks', () => { beforeEach(() => { jest.resetModules(); React = require('react'); ReactNoop = require('react-noop-renderer'); - chunk = React.chunk; + block = React.block; useState = React.useState; Suspense = React.Suspense; let cache = new Map(); @@ -63,7 +63,7 @@ describe('ReactChunks', () => { ); } - let loadUser = chunk(Query, Render); + let loadUser = block(Query, Render); function App({User}) { return ( @@ -102,7 +102,7 @@ describe('ReactChunks', () => { ); } - let loadUser = chunk(Query, Render); + let loadUser = block(Query, Render); function App({User}) { return ( @@ -164,7 +164,7 @@ describe('ReactChunks', () => { ); } - let loadUser = chunk(Query, Render); + let loadUser = block(Query, Render); function App({User}) { return ( diff --git a/packages/react-test-renderer/src/ReactTestRenderer.js b/packages/react-test-renderer/src/ReactTestRenderer.js index e8ec6cbd53e6a..0bd57d4702645 100644 --- a/packages/react-test-renderer/src/ReactTestRenderer.js +++ b/packages/react-test-renderer/src/ReactTestRenderer.js @@ -37,7 +37,7 @@ import { Profiler, MemoComponent, SimpleMemoComponent, - Chunk, + Block, IncompleteClassComponent, ScopeComponent, } from 'shared/ReactWorkTags'; @@ -188,9 +188,9 @@ function toTree(node: ?Fiber) { instance: null, rendered: childrenToTree(node.child), }; - case Chunk: + case Block: return { - nodeType: 'chunk', + nodeType: 'block', type: node.type, props: {...node.memoizedProps}, instance: null, @@ -233,7 +233,7 @@ const validWrapperTypes = new Set([ ForwardRef, MemoComponent, SimpleMemoComponent, - Chunk, + Block, // Normally skipped, but used when there's more than one root child. HostRoot, ]); diff --git a/packages/react/src/React.js b/packages/react/src/React.js index ad515bd321dfc..23fb0f87917b6 100644 --- a/packages/react/src/React.js +++ b/packages/react/src/React.js @@ -28,7 +28,7 @@ import {createContext} from './ReactContext'; import {lazy} from './ReactLazy'; import forwardRef from './forwardRef'; import memo from './memo'; -import chunk from './chunk'; +import block from './block'; import { useCallback, useContext, @@ -63,7 +63,7 @@ import { enableFundamentalAPI, enableScopeAPI, exposeConcurrentModeAPIs, - enableChunksAPI, + enableBlocksAPI, disableCreateFactory, } from 'shared/ReactFeatureFlags'; const React = { @@ -120,8 +120,8 @@ if (exposeConcurrentModeAPIs) { React.unstable_withSuspenseConfig = withSuspenseConfig; } -if (enableChunksAPI) { - React.chunk = chunk; +if (enableBlocksAPI) { + React.block = block; } if (enableDeprecatedFlareAPI) { diff --git a/packages/react/src/chunk.js b/packages/react/src/block.js similarity index 74% rename from packages/react/src/chunk.js rename to packages/react/src/block.js index 90bf8ac56ffdb..575f8b66ea322 100644 --- a/packages/react/src/chunk.js +++ b/packages/react/src/block.js @@ -6,47 +6,47 @@ */ import { - REACT_CHUNK_TYPE, + REACT_BLOCK_TYPE, REACT_MEMO_TYPE, REACT_FORWARD_REF_TYPE, } from 'shared/ReactSymbols'; -opaque type Chunk: React$AbstractComponent< +opaque type Block: React$AbstractComponent< Props, null, > = React$AbstractComponent; -export default function chunk( +export default function block( query: (...args: Args) => Data, render: (props: Props, data: Data) => React$Node, -): (...args: Args) => Chunk { +): (...args: Args) => Block { if (__DEV__) { if (typeof query !== 'function') { console.error( - 'Chunks require a query function but was given %s.', + 'Blocks require a query function but was given %s.', query === null ? 'null' : typeof query, ); } if (render != null && render.$$typeof === REACT_MEMO_TYPE) { console.error( - 'Chunks require a render function but received a `memo` ' + + 'Blocks require a render function but received a `memo` ' + 'component. Use `memo` on an inner component instead.', ); } else if (render != null && render.$$typeof === REACT_FORWARD_REF_TYPE) { console.error( - 'Chunks require a render function but received a `forwardRef` ' + + 'Blocks require a render function but received a `forwardRef` ' + 'component. Use `forwardRef` on an inner component instead.', ); } else if (typeof render !== 'function') { console.error( - 'Chunks require a render function but was given %s.', + 'Blocks require a render function but was given %s.', render === null ? 'null' : typeof render, ); } else if (render.length !== 0 && render.length !== 2) { // Warn if it's not accepting two args. // Do not warn for 0 arguments because it could be due to usage of the 'arguments' object console.error( - 'Chunk render functions accept exactly two parameters: props and data. %s', + 'Block render functions accept exactly two parameters: props and data. %s', render.length === 1 ? 'Did you forget to use the data parameter?' : 'Any additional parameter will be undefined.', @@ -58,15 +58,15 @@ export default function chunk( (render.defaultProps != null || render.propTypes != null) ) { console.error( - 'Chunk render functions do not support propTypes or defaultProps. ' + + 'Block render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?', ); } } - return function(): Chunk { + return function(): Block { let args = arguments; return { - $$typeof: REACT_CHUNK_TYPE, + $$typeof: REACT_BLOCK_TYPE, query: function() { return query.apply(null, args); }, diff --git a/packages/shared/ReactFeatureFlags.js b/packages/shared/ReactFeatureFlags.js index abe712ed685e4..b9edb1371d662 100644 --- a/packages/shared/ReactFeatureFlags.js +++ b/packages/shared/ReactFeatureFlags.js @@ -31,7 +31,7 @@ export const enableSuspenseServerRenderer = __EXPERIMENTAL__; export const enableSelectiveHydration = __EXPERIMENTAL__; // Flight experiments -export const enableChunksAPI = __EXPERIMENTAL__; +export const enableBlocksAPI = __EXPERIMENTAL__; // Only used in www builds. export const enableSchedulerDebugging = false; diff --git a/packages/shared/ReactSymbols.js b/packages/shared/ReactSymbols.js index acc990d04c93c..6e6dd6c30690c 100644 --- a/packages/shared/ReactSymbols.js +++ b/packages/shared/ReactSymbols.js @@ -51,7 +51,7 @@ export const REACT_SUSPENSE_LIST_TYPE = hasSymbol : 0xead8; export const REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; export const REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; -export const REACT_CHUNK_TYPE = hasSymbol ? Symbol.for('react.chunk') : 0xead9; +export const REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; export const REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; diff --git a/packages/shared/ReactWorkTags.js b/packages/shared/ReactWorkTags.js index 9fa017983f816..c8675c72259cf 100644 --- a/packages/shared/ReactWorkTags.js +++ b/packages/shared/ReactWorkTags.js @@ -54,4 +54,4 @@ export const DehydratedFragment = 18; export const SuspenseListComponent = 19; export const FundamentalComponent = 20; export const ScopeComponent = 21; -export const Chunk = 22; +export const Block = 22; diff --git a/packages/shared/forks/ReactFeatureFlags.native-fb.js b/packages/shared/forks/ReactFeatureFlags.native-fb.js index ccbc3bc85f7fc..6bd39e8a602a7 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-fb.js +++ b/packages/shared/forks/ReactFeatureFlags.native-fb.js @@ -23,7 +23,7 @@ export const enableProfilerTimer = __PROFILE__; export const enableSchedulerTracing = __PROFILE__; export const enableSuspenseServerRenderer = false; export const enableSelectiveHydration = false; -export const enableChunksAPI = false; +export const enableBlocksAPI = false; export const exposeConcurrentModeAPIs = __EXPERIMENTAL__; export const warnAboutShorthandPropertyCollision = true; export const enableSchedulerDebugging = false; diff --git a/packages/shared/forks/ReactFeatureFlags.native-oss.js b/packages/shared/forks/ReactFeatureFlags.native-oss.js index c1f2ad0d43dac..5c5e388d4997f 100644 --- a/packages/shared/forks/ReactFeatureFlags.native-oss.js +++ b/packages/shared/forks/ReactFeatureFlags.native-oss.js @@ -20,7 +20,7 @@ export const enableProfilerTimer = __PROFILE__; export const enableSchedulerTracing = __PROFILE__; export const enableSuspenseServerRenderer = false; export const enableSelectiveHydration = false; -export const enableChunksAPI = false; +export const enableBlocksAPI = false; export const disableJavaScriptURLs = false; export const disableInputAttributeSyncing = false; export const exposeConcurrentModeAPIs = __EXPERIMENTAL__; diff --git a/packages/shared/forks/ReactFeatureFlags.persistent.js b/packages/shared/forks/ReactFeatureFlags.persistent.js index 3cd7a4c13b757..a1c62664289ae 100644 --- a/packages/shared/forks/ReactFeatureFlags.persistent.js +++ b/packages/shared/forks/ReactFeatureFlags.persistent.js @@ -20,7 +20,7 @@ export const enableProfilerTimer = __PROFILE__; export const enableSchedulerTracing = __PROFILE__; export const enableSuspenseServerRenderer = false; export const enableSelectiveHydration = false; -export const enableChunksAPI = false; +export const enableBlocksAPI = false; export const disableJavaScriptURLs = false; export const disableInputAttributeSyncing = false; export const exposeConcurrentModeAPIs = __EXPERIMENTAL__; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.js index 00176945bc98a..d6fa0200a031b 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.js @@ -20,7 +20,7 @@ export const enableProfilerTimer = __PROFILE__; export const enableSchedulerTracing = __PROFILE__; export const enableSuspenseServerRenderer = false; export const enableSelectiveHydration = false; -export const enableChunksAPI = false; +export const enableBlocksAPI = false; export const disableJavaScriptURLs = false; export const disableInputAttributeSyncing = false; export const exposeConcurrentModeAPIs = __EXPERIMENTAL__; diff --git a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js index 08b934bd589a2..4007b5483ea88 100644 --- a/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js +++ b/packages/shared/forks/ReactFeatureFlags.test-renderer.www.js @@ -20,7 +20,7 @@ export const enableProfilerTimer = __PROFILE__; export const enableSchedulerTracing = __PROFILE__; export const enableSuspenseServerRenderer = false; export const enableSelectiveHydration = false; -export const enableChunksAPI = false; +export const enableBlocksAPI = false; export const exposeConcurrentModeAPIs = __EXPERIMENTAL__; export const warnAboutShorthandPropertyCollision = true; export const enableSchedulerDebugging = false; diff --git a/packages/shared/forks/ReactFeatureFlags.testing.js b/packages/shared/forks/ReactFeatureFlags.testing.js index 4cf22fa4c42de..25a32b7738042 100644 --- a/packages/shared/forks/ReactFeatureFlags.testing.js +++ b/packages/shared/forks/ReactFeatureFlags.testing.js @@ -20,7 +20,7 @@ export const enableProfilerTimer = __PROFILE__; export const enableSchedulerTracing = __PROFILE__; export const enableSuspenseServerRenderer = false; export const enableSelectiveHydration = false; -export const enableChunksAPI = false; +export const enableBlocksAPI = false; export const disableJavaScriptURLs = false; export const disableInputAttributeSyncing = false; export const exposeConcurrentModeAPIs = __EXPERIMENTAL__; diff --git a/packages/shared/forks/ReactFeatureFlags.testing.www.js b/packages/shared/forks/ReactFeatureFlags.testing.www.js index db02d804dadc1..0fdac064a69ba 100644 --- a/packages/shared/forks/ReactFeatureFlags.testing.www.js +++ b/packages/shared/forks/ReactFeatureFlags.testing.www.js @@ -20,7 +20,7 @@ export const enableProfilerTimer = false; export const enableSchedulerTracing = false; export const enableSuspenseServerRenderer = true; export const enableSelectiveHydration = true; -export const enableChunksAPI = true; +export const enableBlocksAPI = true; export const disableJavaScriptURLs = true; export const disableInputAttributeSyncing = false; export const exposeConcurrentModeAPIs = true; diff --git a/packages/shared/forks/ReactFeatureFlags.www.js b/packages/shared/forks/ReactFeatureFlags.www.js index ca181c34c0175..c8fc90a8e52a2 100644 --- a/packages/shared/forks/ReactFeatureFlags.www.js +++ b/packages/shared/forks/ReactFeatureFlags.www.js @@ -49,7 +49,7 @@ export const exposeConcurrentModeAPIs = true; export const enableSuspenseServerRenderer = true; export const enableSelectiveHydration = true; -export const enableChunksAPI = true; +export const enableBlocksAPI = true; export const disableJavaScriptURLs = true; diff --git a/packages/shared/getComponentName.js b/packages/shared/getComponentName.js index f90ca1fbe35e0..e2ad538e584a9 100644 --- a/packages/shared/getComponentName.js +++ b/packages/shared/getComponentName.js @@ -21,7 +21,7 @@ import { REACT_SUSPENSE_TYPE, REACT_SUSPENSE_LIST_TYPE, REACT_LAZY_TYPE, - REACT_CHUNK_TYPE, + REACT_BLOCK_TYPE, } from 'shared/ReactSymbols'; import {refineResolvedLazyComponent} from 'shared/ReactLazyComponent'; @@ -80,7 +80,7 @@ function getComponentName(type: mixed): string | null { return getWrappedName(type, type.render, 'ForwardRef'); case REACT_MEMO_TYPE: return getComponentName(type.type); - case REACT_CHUNK_TYPE: + case REACT_BLOCK_TYPE: return getComponentName(type.render); case REACT_LAZY_TYPE: { const thenable: LazyComponent = (type: any); diff --git a/packages/shared/isValidElementType.js b/packages/shared/isValidElementType.js index c4a6ce0d4e338..187dcf8c8f987 100644 --- a/packages/shared/isValidElementType.js +++ b/packages/shared/isValidElementType.js @@ -22,7 +22,7 @@ import { REACT_FUNDAMENTAL_TYPE, REACT_RESPONDER_TYPE, REACT_SCOPE_TYPE, - REACT_CHUNK_TYPE, + REACT_BLOCK_TYPE, } from 'shared/ReactSymbols'; export default function isValidElementType(type: mixed) { @@ -46,6 +46,6 @@ export default function isValidElementType(type: mixed) { type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || - type.$$typeof === REACT_CHUNK_TYPE)) + type.$$typeof === REACT_BLOCK_TYPE)) ); }