diff --git a/packages/react-devtools-shared/src/utils.js b/packages/react-devtools-shared/src/utils.js index c412a0f562bcb..19b6ece3a75cd 100644 --- a/packages/react-devtools-shared/src/utils.js +++ b/packages/react-devtools-shared/src/utils.js @@ -11,8 +11,6 @@ import LRU from 'lru-cache'; import { isElement, typeOf, - AsyncMode, - ConcurrentMode, ContextConsumer, ContextProvider, ForwardRef, @@ -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: diff --git a/packages/react-dom/src/server/ReactPartialRenderer.js b/packages/react-dom/src/server/ReactPartialRenderer.js index 139c2f21e6dea..919d58a589967 100644 --- a/packages/react-dom/src/server/ReactPartialRenderer.js +++ b/packages/react-dom/src/server/ReactPartialRenderer.js @@ -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, @@ -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: { diff --git a/packages/react-is/src/ReactIs.js b/packages/react-is/src/ReactIs.js index 0ca1ddc91b9f2..2b0b03e38d370 100644 --- a/packages/react-is/src/ReactIs.js +++ b/packages/react-is/src/ReactIs.js @@ -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, @@ -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: @@ -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; @@ -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) { @@ -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; diff --git a/packages/react-reconciler/src/ReactFiber.js b/packages/react-reconciler/src/ReactFiber.js index ea41e2b10e829..3c181dfbd0cc5 100644 --- a/packages/react-reconciler/src/ReactFiber.js +++ b/packages/react-reconciler/src/ReactFiber.js @@ -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, @@ -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; diff --git a/packages/shared/ReactSymbols.js b/packages/shared/ReactSymbols.js index e05d8bf0f3bb7..527dd2ab42ce9 100644 --- a/packages/shared/ReactSymbols.js +++ b/packages/shared/ReactSymbols.js @@ -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; diff --git a/packages/shared/isValidElementType.js b/packages/shared/isValidElementType.js index fb71c26971283..93a21b6570835 100644 --- a/packages/shared/isValidElementType.js +++ b/packages/shared/isValidElementType.js @@ -8,7 +8,6 @@ */ import { - REACT_CONCURRENT_MODE_TYPE, REACT_CONTEXT_TYPE, REACT_FORWARD_REF_TYPE, REACT_FRAGMENT_TYPE, @@ -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 ||