Skip to content

Commit

Permalink
Remove ConcurrentMode and AsyncMode symbols (#18450)
Browse files Browse the repository at this point in the history
This API was never released.
  • Loading branch information
sebmarkbage authored Apr 1, 2020
1 parent d6d5f5a commit e2c6702
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 33 deletions.
5 changes: 0 additions & 5 deletions packages/react-devtools-shared/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import LRU from 'lru-cache';
import {
isElement,
typeOf,
AsyncMode,
ConcurrentMode,
ContextConsumer,
ContextProvider,
ForwardRef,
Expand Down Expand Up @@ -424,9 +422,6 @@ export function getDisplayNameForReactElement(
): string | null {
const elementType = typeOf(element);
switch (elementType) {
case AsyncMode:
case ConcurrentMode:
return 'ConcurrentMode';
case ContextConsumer:
return 'ContextConsumer';
case ContextProvider:
Expand Down
2 changes: 0 additions & 2 deletions packages/react-dom/src/server/ReactPartialRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import {
REACT_FORWARD_REF_TYPE,
REACT_FRAGMENT_TYPE,
REACT_STRICT_MODE_TYPE,
REACT_CONCURRENT_MODE_TYPE,
REACT_SUSPENSE_TYPE,
REACT_SUSPENSE_LIST_TYPE,
REACT_PORTAL_TYPE,
Expand Down Expand Up @@ -993,7 +992,6 @@ class ReactDOMServerRenderer {

switch (elementType) {
case REACT_STRICT_MODE_TYPE:
case REACT_CONCURRENT_MODE_TYPE:
case REACT_PROFILER_TYPE:
case REACT_SUSPENSE_LIST_TYPE:
case REACT_FRAGMENT_TYPE: {
Expand Down
25 changes: 14 additions & 11 deletions packages/react-is/src/ReactIs.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
'use strict';

import {
REACT_ASYNC_MODE_TYPE,
REACT_CONCURRENT_MODE_TYPE,
REACT_CONTEXT_TYPE,
REACT_ELEMENT_TYPE,
REACT_FORWARD_REF_TYPE,
Expand All @@ -34,8 +32,6 @@ export function typeOf(object: any) {
const type = object.type;

switch (type) {
case REACT_ASYNC_MODE_TYPE:
case REACT_CONCURRENT_MODE_TYPE:
case REACT_FRAGMENT_TYPE:
case REACT_PROFILER_TYPE:
case REACT_STRICT_MODE_TYPE:
Expand Down Expand Up @@ -63,9 +59,6 @@ export function typeOf(object: any) {
return undefined;
}

// AsyncMode is deprecated along with isAsyncMode
export const AsyncMode = REACT_ASYNC_MODE_TYPE;
export const ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
export const ContextConsumer = REACT_CONTEXT_TYPE;
export const ContextProvider = REACT_PROVIDER_TYPE;
export const Element = REACT_ELEMENT_TYPE;
Expand All @@ -81,6 +74,7 @@ export const Suspense = REACT_SUSPENSE_TYPE;
export {isValidElementType};

let hasWarnedAboutDeprecatedIsAsyncMode = false;
let hasWarnedAboutDeprecatedIsConcurrentMode = false;

// AsyncMode should be deprecated
export function isAsyncMode(object: any) {
Expand All @@ -90,15 +84,24 @@ export function isAsyncMode(object: any) {
// Using console['warn'] to evade Babel and ESLint
console['warn'](
'The ReactIs.isAsyncMode() alias has been deprecated, ' +
'and will be removed in React 17+. Update your code to use ' +
'ReactIs.isConcurrentMode() instead. It has the exact same API.',
'and will be removed in React 17+.',
);
}
}
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
return false;
}
export function isConcurrentMode(object: any) {
return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
if (__DEV__) {
if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
hasWarnedAboutDeprecatedIsConcurrentMode = true;
// Using console['warn'] to evade Babel and ESLint
console['warn'](
'The ReactIs.isConcurrentMode() alias has been deprecated, ' +
'and will be removed in React 17+.',
);
}
}
return false;
}
export function isContextConsumer(object: any) {
return typeOf(object) === REACT_CONTEXT_TYPE;
Expand Down
5 changes: 0 additions & 5 deletions packages/react-reconciler/src/ReactFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ import {
REACT_PROFILER_TYPE,
REACT_PROVIDER_TYPE,
REACT_CONTEXT_TYPE,
REACT_CONCURRENT_MODE_TYPE,
REACT_SUSPENSE_TYPE,
REACT_SUSPENSE_LIST_TYPE,
REACT_MEMO_TYPE,
Expand Down Expand Up @@ -638,10 +637,6 @@ export function createFiberFromTypeAndProps(
expirationTime,
key,
);
case REACT_CONCURRENT_MODE_TYPE:
fiberTag = Mode;
mode |= ConcurrentMode | BlockingMode | StrictMode;
break;
case REACT_STRICT_MODE_TYPE:
fiberTag = Mode;
mode |= StrictMode;
Expand Down
8 changes: 0 additions & 8 deletions packages/shared/ReactSymbols.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,6 @@ export const REACT_PROVIDER_TYPE = hasSymbol
export const REACT_CONTEXT_TYPE = hasSymbol
? Symbol.for('react.context')
: 0xeace;
// TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
// (unstable) APIs that have been removed. Can we remove the symbols?
export const REACT_ASYNC_MODE_TYPE = hasSymbol
? Symbol.for('react.async_mode')
: 0xeacf;
export const REACT_CONCURRENT_MODE_TYPE = hasSymbol
? Symbol.for('react.concurrent_mode')
: 0xeacf;
export const REACT_FORWARD_REF_TYPE = hasSymbol
? Symbol.for('react.forward_ref')
: 0xead0;
Expand Down
2 changes: 0 additions & 2 deletions packages/shared/isValidElementType.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
*/

import {
REACT_CONCURRENT_MODE_TYPE,
REACT_CONTEXT_TYPE,
REACT_FORWARD_REF_TYPE,
REACT_FRAGMENT_TYPE,
Expand All @@ -32,7 +31,6 @@ export default function isValidElementType(type: mixed) {
typeof type === 'function' ||
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
type === REACT_FRAGMENT_TYPE ||
type === REACT_CONCURRENT_MODE_TYPE ||
type === REACT_PROFILER_TYPE ||
type === REACT_STRICT_MODE_TYPE ||
type === REACT_SUSPENSE_TYPE ||
Expand Down

0 comments on commit e2c6702

Please sign in to comment.