diff --git a/packages/react-call-return/README.md b/packages/react-call-return/README.md deleted file mode 100644 index 6cfd1265aabfe..0000000000000 --- a/packages/react-call-return/README.md +++ /dev/null @@ -1,32 +0,0 @@ -# react-call-return - -This is an experimental package for multi-pass rendering in React. - -**Its API is not as stable as that of React, React Native, or React DOM, and does not follow the common versioning scheme.** - -**Use it at your own risk.** - -# No, Really, It Is Unstable - -This is **an experiment**. - -We **will** replace this with a different API in the future. -It can break between patch versions of React. - -We also know that **it has bugs**. - -Don't rely on this for anything except experiments. -Even in experiments, make sure to lock the versions so that an update doesn't break your app. - -Don't publish third party components relying on this unless you clearly mark them as experimental too. -They will break. - -Have fun! Let us know if you find interesting use cases for it. - -# API - -See the test case in `src/__tests__/ReactCallReturn.js` for an example. - -# What and Why - -The API is not very intuitive right now, but [this is a good overview](https://cdb.reacttraining.com/react-call-return-what-and-why-7e7761f81843) of why it might be useful in some cases. We are very open to better API ideas for this concept. diff --git a/packages/react-call-return/index.js b/packages/react-call-return/index.js deleted file mode 100644 index 8d3798337c698..0000000000000 --- a/packages/react-call-return/index.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - */ - -'use strict'; - -module.exports = require('./src/ReactCallReturn'); diff --git a/packages/react-call-return/npm/index.js b/packages/react-call-return/npm/index.js deleted file mode 100644 index 0856ded523d75..0000000000000 --- a/packages/react-call-return/npm/index.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/react-call-return.production.min.js'); -} else { - module.exports = require('./cjs/react-call-return.development.js'); -} diff --git a/packages/react-call-return/package.json b/packages/react-call-return/package.json deleted file mode 100644 index 52256ef0f9478..0000000000000 --- a/packages/react-call-return/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "react-call-return", - "description": "Experimental APIs for multi-pass rendering in React.", - "version": "0.8.0", - "repository": "facebook/react", - "files": [ - "LICENSE", - "README.md", - "index.js", - "cjs/" - ], - "dependencies": { - "fbjs": "^0.8.16", - "object-assign": "^4.1.1" - }, - "peerDependencies": { - "react": "^16.0.0" - } -} diff --git a/packages/react-call-return/src/ReactCallReturn.js b/packages/react-call-return/src/ReactCallReturn.js deleted file mode 100644 index 432ff8f192223..0000000000000 --- a/packages/react-call-return/src/ReactCallReturn.js +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) 2014-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - */ - -import { - REACT_CALL_TYPE, - REACT_RETURN_TYPE, - REACT_ELEMENT_TYPE, -} from 'shared/ReactSymbols'; - -import type {ReactCall, ReactNodeList, ReactReturn} from 'shared/ReactTypes'; - -type CallHandler = (props: T, returns: Array) => ReactNodeList; - -export function unstable_createCall( - children: ReactNodeList, - handler: CallHandler, - props: T, - key: ?string = null, -): ReactCall { - const call = { - // This tag allow us to uniquely identify this as a React Call - $$typeof: REACT_ELEMENT_TYPE, - type: REACT_CALL_TYPE, - key: key == null ? null : '' + key, - ref: null, - props: { - props, - handler, - children: children, - }, - }; - - if (__DEV__) { - // TODO: Add _store property for marking this as validated. - if (Object.freeze) { - Object.freeze(call.props); - Object.freeze(call); - } - } - - return call; -} - -export function unstable_createReturn(value: V): ReactReturn { - const returnNode = { - // This tag allow us to uniquely identify this as a React Call - $$typeof: REACT_ELEMENT_TYPE, - type: REACT_RETURN_TYPE, - key: null, - ref: null, - props: { - value, - }, - }; - - if (__DEV__) { - // TODO: Add _store property for marking this as validated. - if (Object.freeze) { - Object.freeze(returnNode); - } - } - - return returnNode; -} - -/** - * Verifies the object is a call object. - */ -export function unstable_isCall(object: mixed): boolean { - return ( - typeof object === 'object' && - object !== null && - object.type === REACT_CALL_TYPE - ); -} - -/** - * Verifies the object is a return object. - */ -export function unstable_isReturn(object: mixed): boolean { - return ( - typeof object === 'object' && - object !== null && - object.type === REACT_RETURN_TYPE - ); -} - -export const unstable_REACT_RETURN_TYPE = REACT_RETURN_TYPE; -export const unstable_REACT_CALL_TYPE = REACT_CALL_TYPE; diff --git a/packages/react-call-return/src/__tests__/ReactCallReturn-test.internal.js b/packages/react-call-return/src/__tests__/ReactCallReturn-test.internal.js deleted file mode 100644 index 84018bac30b6f..0000000000000 --- a/packages/react-call-return/src/__tests__/ReactCallReturn-test.internal.js +++ /dev/null @@ -1,326 +0,0 @@ -/** - * Copyright (c) 2013-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @emails react-core - */ - -'use strict'; - -let React; -let ReactFeatureFlags; -let ReactNoop; -let ReactCallReturn; - -describe('ReactCallReturn', () => { - beforeEach(() => { - jest.resetModules(); - ReactFeatureFlags = require('shared/ReactFeatureFlags'); - ReactFeatureFlags.debugRenderPhaseSideEffectsForStrictMode = false; - React = require('react'); - ReactNoop = require('react-noop-renderer'); - ReactCallReturn = require('react-call-return'); - }); - - function div(...children) { - children = children.map(c => (typeof c === 'string' ? {text: c} : c)); - return {type: 'div', children, prop: undefined}; - } - - function span(prop) { - return {type: 'span', children: [], prop}; - } - - it('should render a call', () => { - const ops = []; - - function Continuation({isSame}) { - ops.push(['Continuation', isSame]); - return ; - } - - // An alternative API could mark Continuation as something that needs - // returning. E.g. Continuation.returnType = 123; - function Child({bar}) { - ops.push(['Child', bar]); - return ReactCallReturn.unstable_createReturn({ - props: { - bar: bar, - }, - continuation: Continuation, - }); - } - - function Indirection() { - ops.push('Indirection'); - return [, ]; - } - - function HandleReturns(props, returns) { - ops.push('HandleReturns'); - return returns.map((y, i) => ( - - )); - } - - // An alternative API could mark Parent as something that needs - // returning. E.g. Parent.handler = HandleReturns; - function Parent(props) { - ops.push('Parent'); - return ReactCallReturn.unstable_createCall( - props.children, - HandleReturns, - props, - ); - } - - function App() { - return ( -
- - - -
- ); - } - - ReactNoop.render(); - ReactNoop.flush(); - - expect(ops).toEqual([ - 'Parent', - 'Indirection', - ['Child', true], - // Return - ['Child', false], - // Return - 'HandleReturns', - // Call continuations - ['Continuation', true], - ['Continuation', false], - ]); - expect(ReactNoop.getChildren()).toEqual([ - div(span('foo==bar'), span('foo!=bar')), - ]); - }); - - it('should update a call', () => { - function Continuation({isSame}) { - return ; - } - - function Child({bar}) { - return ReactCallReturn.unstable_createReturn({ - props: { - bar: bar, - }, - continuation: Continuation, - }); - } - - function Indirection() { - return [, ]; - } - - function HandleReturns(props, returns) { - return returns.map((y, i) => ( - - )); - } - - function Parent(props) { - return ReactCallReturn.unstable_createCall( - props.children, - HandleReturns, - props, - ); - } - - function App(props) { - return ( -
- - - -
- ); - } - - ReactNoop.render(); - ReactNoop.flush(); - expect(ReactNoop.getChildren()).toEqual([ - div(span('foo==bar'), span('foo!=bar')), - ]); - - ReactNoop.render(); - ReactNoop.flush(); - expect(ReactNoop.getChildren()).toEqual([ - div(span('foo!=bar'), span('foo==bar')), - ]); - }); - - it('should unmount a composite in a call', () => { - let ops = []; - - class Continuation extends React.Component { - render() { - ops.push('Continuation'); - return
; - } - componentWillUnmount() { - ops.push('Unmount Continuation'); - } - } - - class Child extends React.Component { - render() { - ops.push('Child'); - return ReactCallReturn.unstable_createReturn(Continuation); - } - componentWillUnmount() { - ops.push('Unmount Child'); - } - } - - function HandleReturns(props, returns) { - ops.push('HandleReturns'); - return returns.map((ContinuationComponent, i) => ( - - )); - } - - class Parent extends React.Component { - render() { - ops.push('Parent'); - return ReactCallReturn.unstable_createCall( - this.props.children, - HandleReturns, - this.props, - ); - } - componentWillUnmount() { - ops.push('Unmount Parent'); - } - } - - ReactNoop.render( - - - , - ); - ReactNoop.flush(); - - expect(ops).toEqual(['Parent', 'Child', 'HandleReturns', 'Continuation']); - - ops = []; - - ReactNoop.render(
); - ReactNoop.flush(); - - expect(ops).toEqual([ - 'Unmount Parent', - 'Unmount Child', - 'Unmount Continuation', - ]); - }); - - it('should handle deep updates in call', () => { - let instances = {}; - - class Counter extends React.Component { - state = {value: 5}; - render() { - instances[this.props.id] = this; - return ReactCallReturn.unstable_createReturn(this.state.value); - } - } - - function App(props) { - return ReactCallReturn.unstable_createCall( - [ - , - , - , - ], - (p, returns) => returns.map((y, i) => ), - {}, - ); - } - - ReactNoop.render(); - ReactNoop.flush(); - expect(ReactNoop.getChildren()).toEqual([span(500), span(500), span(500)]); - - instances.a.setState({value: 1}); - instances.b.setState({value: 2}); - ReactNoop.flush(); - expect(ReactNoop.getChildren()).toEqual([span(100), span(200), span(500)]); - }); - - it('should unmount and remount children', () => { - let ops = []; - - class Call extends React.Component { - render() { - return ReactCallReturn.unstable_createCall( - this.props.children, - (p, returns) => returns, - {}, - ); - } - } - - class Return extends React.Component { - render() { - ops.push(`Return ${this.props.value}`); - return ReactCallReturn.unstable_createReturn(this.props.children); - } - - UNSAFE_componentWillMount() { - ops.push(`Mount Return ${this.props.value}`); - } - - componentWillUnmount() { - ops.push(`Unmount Return ${this.props.value}`); - } - } - - ReactNoop.render( - - - - , - ); - expect(ReactNoop.flush).toWarnDev( - 'componentWillMount: Please update the following components ' + - 'to use componentDidMount instead: Return', - ); - - expect(ops).toEqual([ - 'Mount Return 1', - 'Return 1', - 'Mount Return 2', - 'Return 2', - ]); - - ops = []; - - ReactNoop.render(); - ReactNoop.flush(); - - expect(ops).toEqual(['Unmount Return 1', 'Unmount Return 2']); - - ops = []; - - ReactNoop.render( - - - , - ); - ReactNoop.flush(); - - expect(ops).toEqual(['Mount Return 3', 'Return 3']); - }); -}); diff --git a/packages/react-dom/src/__tests__/ReactServerRendering-test.internal.js b/packages/react-dom/src/__tests__/ReactServerRendering-test.internal.js index 05eb32ba037a8..b7c6eca3de0cc 100644 --- a/packages/react-dom/src/__tests__/ReactServerRendering-test.internal.js +++ b/packages/react-dom/src/__tests__/ReactServerRendering-test.internal.js @@ -11,7 +11,6 @@ 'use strict'; let React; -let ReactCallReturn; let ReactDOMServer; let PropTypes; @@ -23,7 +22,6 @@ describe('ReactDOMServer', () => { beforeEach(() => { jest.resetModules(); React = require('react'); - ReactCallReturn = require('react-call-return'); PropTypes = require('prop-types'); ReactDOMServer = require('react-dom/server'); }); @@ -623,25 +621,6 @@ describe('ReactDOMServer', () => { ); }); - it('should throw rendering call/return on the server', () => { - expect(() => { - ReactDOMServer.renderToString( -
{ReactCallReturn.unstable_createReturn(42)}
, - ); - }).toThrow( - 'The experimental Call and Return types are not currently supported by the server renderer.', - ); - expect(() => { - ReactDOMServer.renderToString( -
- {ReactCallReturn.unstable_createCall(null, function() {}, {})} -
, - ); - }).toThrow( - 'The experimental Call and Return types are not currently supported by the server renderer.', - ); - }); - it('should warn when server rendering a class with a render method that does not extend React.Component', () => { class ClassWithRenderNotExtended { render() { diff --git a/packages/react-dom/src/server/ReactPartialRenderer.js b/packages/react-dom/src/server/ReactPartialRenderer.js index d0cef9c60a4e8..59ea170b938d5 100644 --- a/packages/react-dom/src/server/ReactPartialRenderer.js +++ b/packages/react-dom/src/server/ReactPartialRenderer.js @@ -31,8 +31,6 @@ import { REACT_FRAGMENT_TYPE, REACT_STRICT_MODE_TYPE, REACT_ASYNC_MODE_TYPE, - REACT_CALL_TYPE, - REACT_RETURN_TYPE, REACT_PORTAL_TYPE, REACT_PROFILER_TYPE, REACT_PROVIDER_TYPE, @@ -831,13 +829,6 @@ class ReactDOMServerRenderer { this.stack.push(frame); return ''; } - case REACT_CALL_TYPE: - case REACT_RETURN_TYPE: - invariant( - false, - 'The experimental Call and Return types are not currently ' + - 'supported by the server renderer.', - ); // eslint-disable-next-line-no-fallthrough default: break; diff --git a/packages/react-reconciler/src/ReactDebugFiberPerf.js b/packages/react-reconciler/src/ReactDebugFiberPerf.js index c2889986bff4e..7c2226f9a8529 100644 --- a/packages/react-reconciler/src/ReactDebugFiberPerf.js +++ b/packages/react-reconciler/src/ReactDebugFiberPerf.js @@ -16,8 +16,6 @@ import { HostComponent, HostText, HostPortal, - CallComponent, - ReturnComponent, Fragment, ContextProvider, ContextConsumer, @@ -171,8 +169,6 @@ const shouldIgnoreFiber = (fiber: Fiber): boolean => { case HostComponent: case HostText: case HostPortal: - case CallComponent: - case ReturnComponent: case Fragment: case ContextProvider: case ContextConsumer: diff --git a/packages/react-reconciler/src/ReactFiber.js b/packages/react-reconciler/src/ReactFiber.js index 720fb9ffe1fb7..acfedb266c4ca 100644 --- a/packages/react-reconciler/src/ReactFiber.js +++ b/packages/react-reconciler/src/ReactFiber.js @@ -24,8 +24,6 @@ import { HostComponent, HostText, HostPortal, - CallComponent, - ReturnComponent, ForwardRef, Fragment, Mode, @@ -41,8 +39,6 @@ import {NoContext, AsyncMode, ProfileMode, StrictMode} from './ReactTypeOfMode'; import { REACT_FORWARD_REF_TYPE, REACT_FRAGMENT_TYPE, - REACT_RETURN_TYPE, - REACT_CALL_TYPE, REACT_STRICT_MODE_TYPE, REACT_PROFILER_TYPE, REACT_PROVIDER_TYPE, @@ -364,12 +360,6 @@ export function createFiberFromElement( break; case REACT_PROFILER_TYPE: return createFiberFromProfiler(pendingProps, mode, expirationTime, key); - case REACT_CALL_TYPE: - fiberTag = CallComponent; - break; - case REACT_RETURN_TYPE: - fiberTag = ReturnComponent; - break; case REACT_TIMEOUT_TYPE: fiberTag = TimeoutComponent; // Suspense does not require async, but its children should be strict diff --git a/packages/react-reconciler/src/ReactFiberBeginWork.js b/packages/react-reconciler/src/ReactFiberBeginWork.js index d08ebd133024a..d344ce0998b42 100644 --- a/packages/react-reconciler/src/ReactFiberBeginWork.js +++ b/packages/react-reconciler/src/ReactFiberBeginWork.js @@ -27,9 +27,6 @@ import { HostComponent, HostText, HostPortal, - CallComponent, - CallHandlerPhase, - ReturnComponent, ForwardRef, Fragment, Mode, @@ -741,44 +738,6 @@ export default function( } } - function updateCallComponent(current, workInProgress, renderExpirationTime) { - let nextProps = workInProgress.pendingProps; - if (hasLegacyContextChanged()) { - // Normally we can bail out on props equality but if context has changed - // we don't do the bailout and we have to reuse existing props instead. - } else if (workInProgress.memoizedProps === nextProps) { - nextProps = workInProgress.memoizedProps; - // TODO: When bailing out, we might need to return the stateNode instead - // of the child. To check it for work. - // return bailoutOnAlreadyFinishedWork(current, workInProgress); - } - - const nextChildren = nextProps.children; - - // The following is a fork of reconcileChildrenAtExpirationTime but using - // stateNode to store the child. - if (current === null) { - workInProgress.stateNode = mountChildFibers( - workInProgress, - workInProgress.stateNode, - nextChildren, - renderExpirationTime, - ); - } else { - workInProgress.stateNode = reconcileChildFibers( - workInProgress, - current.stateNode, - nextChildren, - renderExpirationTime, - ); - } - - memoizeProps(workInProgress, nextProps); - // This doesn't take arbitrary time so we could synchronously just begin - // eagerly do the work of workInProgress.child as an optimization. - return workInProgress.stateNode; - } - function updateTimeoutComponent( current, workInProgress, @@ -1260,20 +1219,6 @@ export default function( ); case HostText: return updateHostText(current, workInProgress); - case CallHandlerPhase: - // This is a restart. Reset the tag to the initial phase. - workInProgress.tag = CallComponent; - // Intentionally fall through since this is now the same. - case CallComponent: - return updateCallComponent( - current, - workInProgress, - renderExpirationTime, - ); - case ReturnComponent: - // A return component is just a placeholder, we can just run through the - // next one immediately. - return null; case TimeoutComponent: return updateTimeoutComponent( current, diff --git a/packages/react-reconciler/src/ReactFiberCommitWork.js b/packages/react-reconciler/src/ReactFiberCommitWork.js index f3184ced83c83..ebe37ef5a0952 100644 --- a/packages/react-reconciler/src/ReactFiberCommitWork.js +++ b/packages/react-reconciler/src/ReactFiberCommitWork.js @@ -25,7 +25,6 @@ import { HostComponent, HostText, HostPortal, - CallComponent, Profiler, TimeoutComponent, } from 'shared/ReactTypeOfWork'; @@ -393,10 +392,6 @@ export default function( safelyDetachRef(current); return; } - case CallComponent: { - commitNestedUnmounts(current.stateNode); - return; - } case HostPortal: { // TODO: this is recursive. // We are also not using this parent because diff --git a/packages/react-reconciler/src/ReactFiberCompleteWork.js b/packages/react-reconciler/src/ReactFiberCompleteWork.js index ab55061b12430..9d2cec1f3586f 100644 --- a/packages/react-reconciler/src/ReactFiberCompleteWork.js +++ b/packages/react-reconciler/src/ReactFiberCompleteWork.js @@ -31,9 +31,6 @@ import { HostComponent, HostText, HostPortal, - CallComponent, - CallHandlerPhase, - ReturnComponent, ContextProvider, ContextConsumer, ForwardRef, @@ -45,8 +42,6 @@ import { import {Placement, Ref, Update} from 'shared/ReactTypeOfSideEffect'; import invariant from 'fbjs/lib/invariant'; -import {reconcileChildFibers} from './ReactChildFiber'; - export default function( config: HostConfig, hostContext: HostContext, @@ -97,75 +92,6 @@ export default function( workInProgress.effectTag |= Ref; } - function appendAllReturns(returns: Array, workInProgress: Fiber) { - let node = workInProgress.stateNode; - if (node) { - node.return = workInProgress; - } - while (node !== null) { - if ( - node.tag === HostComponent || - node.tag === HostText || - node.tag === HostPortal - ) { - invariant(false, 'A call cannot have host component children.'); - } else if (node.tag === ReturnComponent) { - returns.push(node.pendingProps.value); - } else if (node.child !== null) { - node.child.return = node; - node = node.child; - continue; - } - while (node.sibling === null) { - if (node.return === null || node.return === workInProgress) { - return; - } - node = node.return; - } - node.sibling.return = node.return; - node = node.sibling; - } - } - - function moveCallToHandlerPhase( - current: Fiber | null, - workInProgress: Fiber, - renderExpirationTime: ExpirationTime, - ) { - const props = workInProgress.memoizedProps; - invariant( - props, - 'Should be resolved by now. This error is likely caused by a bug in ' + - 'React. Please file an issue.', - ); - - // First step of the call has completed. Now we need to do the second. - // TODO: It would be nice to have a multi stage call represented by a - // single component, or at least tail call optimize nested ones. Currently - // that requires additional fields that we don't want to add to the fiber. - // So this requires nested handlers. - // Note: This doesn't mutate the alternate node. I don't think it needs to - // since this stage is reset for every pass. - workInProgress.tag = CallHandlerPhase; - - // Build up the returns. - // TODO: Compare this to a generator or opaque helpers like Children. - const returns: Array = []; - appendAllReturns(returns, workInProgress); - const fn = props.handler; - const childProps = props.props; - const nextChildren = fn(childProps, returns); - - const currentFirstChild = current !== null ? current.child : null; - workInProgress.child = reconcileChildFibers( - workInProgress, - currentFirstChild, - nextChildren, - renderExpirationTime, - ); - return workInProgress.child; - } - function appendAllChildren(parent: I, workInProgress: Fiber) { // We only have the top Fiber that was created but we need recurse down its // children to find all the terminal nodes. @@ -579,19 +505,6 @@ export default function( } return null; } - case CallComponent: - return moveCallToHandlerPhase( - current, - workInProgress, - renderExpirationTime, - ); - case CallHandlerPhase: - // Reset the tag to now be a first phase call. - workInProgress.tag = CallComponent; - return null; - case ReturnComponent: - // Does nothing. - return null; case ForwardRef: return null; case TimeoutComponent: diff --git a/packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js b/packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js index 1e33804d12f4a..cf89594aaf1de 100644 --- a/packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js +++ b/packages/react-reconciler/src/__tests__/ReactIncrementalPerf-test.internal.js @@ -12,7 +12,6 @@ describe('ReactDebugFiberPerf', () => { let React; - let ReactCallReturn; let ReactNoop; let PropTypes; @@ -121,7 +120,6 @@ describe('ReactDebugFiberPerf', () => { // Import after the polyfill is set up: React = require('react'); ReactNoop = require('react-noop-renderer'); - ReactCallReturn = require('react-call-return'); PropTypes = require('prop-types'); }); @@ -535,53 +533,6 @@ describe('ReactDebugFiberPerf', () => { expect(getFlameChart()).toMatchSnapshot(); }); - it('supports returns', () => { - function Continuation({isSame}) { - return ; - } - - function CoChild({bar}) { - return ReactCallReturn.unstable_createReturn({ - props: { - bar: bar, - }, - continuation: Continuation, - }); - } - - function Indirection() { - return [, ]; - } - - function HandleReturns(props, returns) { - return returns.map((y, i) => ( - - )); - } - - function CoParent(props) { - return ReactCallReturn.unstable_createCall( - props.children, - HandleReturns, - props, - ); - } - - function App() { - return ( -
- - - -
- ); - } - - ReactNoop.render(); - ReactNoop.flush(); - expect(getFlameChart()).toMatchSnapshot(); - }); - it('supports portals', () => { const noopContainer = {children: []}; ReactNoop.render( diff --git a/packages/react-reconciler/src/__tests__/__snapshots__/ReactIncrementalPerf-test.internal.js.snap b/packages/react-reconciler/src/__tests__/__snapshots__/ReactIncrementalPerf-test.internal.js.snap index 4ef5ab820199f..a1e4a1cd8380a 100644 --- a/packages/react-reconciler/src/__tests__/__snapshots__/ReactIncrementalPerf-test.internal.js.snap +++ b/packages/react-reconciler/src/__tests__/__snapshots__/ReactIncrementalPerf-test.internal.js.snap @@ -370,25 +370,6 @@ exports[`ReactDebugFiberPerf supports portals 1`] = ` " `; -exports[`ReactDebugFiberPerf supports returns 1`] = ` -"⚛ (Waiting for async callback... will force flush in 5250 ms) - -⚛ (React Tree Reconciliation: Completed Root) - ⚛ App [mount] - ⚛ CoParent [mount] - ⚛ Indirection [mount] - ⚛ CoChild [mount] - ⚛ CoChild [mount] - ⚛ Continuation [mount] - ⚛ Continuation [mount] - -⚛ (Committing Changes) - ⚛ (Committing Snapshot Effects: 0 Total) - ⚛ (Committing Host Effects: 3 Total) - ⚛ (Calling Lifecycle Methods: 0 Total) -" -`; - exports[`ReactDebugFiberPerf warns if an in-progress update is interrupted 1`] = ` "⚛ (Waiting for async callback... will force flush in 5250 ms) diff --git a/packages/react/src/__tests__/ReactChildren-test.js b/packages/react/src/__tests__/ReactChildren-test.js index ce639254340cf..cf5edb52bd521 100644 --- a/packages/react/src/__tests__/ReactChildren-test.js +++ b/packages/react/src/__tests__/ReactChildren-test.js @@ -69,57 +69,6 @@ describe('ReactChildren', () => { expect(mappedChildren[0]).toEqual(reactPortal); }); - it('should support Call components', () => { - const context = {}; - const callback = jasmine.createSpy().and.callFake(function(kid, index) { - expect(this).toBe(context); - return kid; - }); - const ReactCallReturn = require('react-call-return'); - const reactCall = ReactCallReturn.unstable_createCall( - , - () => {}, - ); - - const parentInstance =
{reactCall}
; - React.Children.forEach(parentInstance.props.children, callback, context); - expect(callback).toHaveBeenCalledWith(reactCall, 0); - callback.calls.reset(); - const mappedChildren = React.Children.map( - parentInstance.props.children, - callback, - context, - ); - expect(callback).toHaveBeenCalledWith(reactCall, 0); - expect(mappedChildren[0].type).toEqual(reactCall.type); - expect(mappedChildren[0].props).toEqual(reactCall.props); - }); - - it('should support Return components', () => { - const context = {}; - const callback = jasmine.createSpy().and.callFake(function(kid, index) { - expect(this).toBe(context); - return kid; - }); - const ReactCallReturn = require('react-call-return'); - const reactReturn = ReactCallReturn.unstable_createReturn( - , - ); - - const parentInstance =
{reactReturn}
; - React.Children.forEach(parentInstance.props.children, callback, context); - expect(callback).toHaveBeenCalledWith(reactReturn, 0); - callback.calls.reset(); - const mappedChildren = React.Children.map( - parentInstance.props.children, - callback, - context, - ); - expect(callback).toHaveBeenCalledWith(reactReturn, 0); - expect(mappedChildren[0].props).toEqual(reactReturn.props); - expect(mappedChildren[0].type).toEqual(reactReturn.type); - }); - it('should treat single arrayless child as being in array', () => { const context = {}; const callback = jasmine.createSpy().and.callFake(function(kid, index) { diff --git a/packages/shared/ReactSymbols.js b/packages/shared/ReactSymbols.js index 9dc1d3627ab40..bd3af4a903e94 100644 --- a/packages/shared/ReactSymbols.js +++ b/packages/shared/ReactSymbols.js @@ -14,10 +14,6 @@ const hasSymbol = typeof Symbol === 'function' && Symbol.for; export const REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; -export const REACT_CALL_TYPE = hasSymbol ? Symbol.for('react.call') : 0xeac8; -export const REACT_RETURN_TYPE = hasSymbol - ? Symbol.for('react.return') - : 0xeac9; export const REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; diff --git a/packages/shared/ReactTypeOfWork.js b/packages/shared/ReactTypeOfWork.js index e6c1ace1d9dd9..5ac284818a120 100644 --- a/packages/shared/ReactTypeOfWork.js +++ b/packages/shared/ReactTypeOfWork.js @@ -33,9 +33,9 @@ export const HostRoot = 3; // Root of a host tree. Could be nested inside anothe export const HostPortal = 4; // A subtree. Could be an entry point to a different renderer. export const HostComponent = 5; export const HostText = 6; -export const CallComponent = 7; -export const CallHandlerPhase = 8; -export const ReturnComponent = 9; +export const CallComponent_UNUSED = 7; +export const CallHandlerPhase_UNUSED = 8; +export const ReturnComponent_UNUSED = 9; export const Fragment = 10; export const Mode = 11; export const ContextConsumer = 12; diff --git a/packages/shared/getComponentName.js b/packages/shared/getComponentName.js index a5f61c5efccfc..b79a2d1c9bfa8 100644 --- a/packages/shared/getComponentName.js +++ b/packages/shared/getComponentName.js @@ -11,14 +11,12 @@ import type {Fiber} from 'react-reconciler/src/ReactFiber'; import { REACT_ASYNC_MODE_TYPE, - REACT_CALL_TYPE, REACT_CONTEXT_TYPE, REACT_FORWARD_REF_TYPE, REACT_FRAGMENT_TYPE, REACT_PORTAL_TYPE, REACT_PROFILER_TYPE, REACT_PROVIDER_TYPE, - REACT_RETURN_TYPE, REACT_STRICT_MODE_TYPE, } from 'shared/ReactSymbols'; @@ -33,8 +31,6 @@ function getComponentName(fiber: Fiber): string | null { switch (type) { case REACT_ASYNC_MODE_TYPE: return 'AsyncMode'; - case REACT_CALL_TYPE: - return 'ReactCall'; case REACT_CONTEXT_TYPE: return 'Context.Consumer'; case REACT_FRAGMENT_TYPE: @@ -45,8 +41,6 @@ function getComponentName(fiber: Fiber): string | null { return `Profiler(${fiber.pendingProps.id})`; case REACT_PROVIDER_TYPE: return 'Context.Provider'; - case REACT_RETURN_TYPE: - return 'ReactReturn'; case REACT_STRICT_MODE_TYPE: return 'StrictMode'; } diff --git a/scripts/rollup/bundles.js b/scripts/rollup/bundles.js index e9f54a11dee65..ae5729a748f3a 100644 --- a/scripts/rollup/bundles.js +++ b/scripts/rollup/bundles.js @@ -328,16 +328,6 @@ const bundles = [ externals: [], }, - /******* React Call Return (experimental) *******/ - { - label: 'react-call-return', - bundleTypes: [NODE_DEV, NODE_PROD], - moduleType: ISOMORPHIC, - entry: 'react-call-return', - global: 'ReactCallReturn', - externals: [], - }, - /******* React Is *******/ { label: 'react-is',