Remove ConcurrentMode and AsyncMode symbols (#18450)
This API was never released.
Sebastian Markbåge committed
Apr 1, 2020 at 10:18 UTC
e2c6702fcaaee35ca08957be7645820192d0daf3
6 files changed
+14
-33
packages/react-devtools-shared/src/utils.js
-5
@@ -11,8 +11,6 @@ import LRU from 'lru-cache';
11
import {
12
isElement,
13
typeOf,
14
- AsyncMode,
15
- ConcurrentMode,
14
ContextConsumer,
15
ContextProvider,
16
ForwardRef,
@@ -424,9 +422,6 @@ export function getDisplayNameForReactElement(
422
): string | null {
423
const elementType = typeOf(element);
424
switch (elementType) {
427
- case AsyncMode:
428
- case ConcurrentMode:
429
- return 'ConcurrentMode';
425
case ContextConsumer:
426
return 'ContextConsumer';
427
case ContextProvider:
packages/react-dom/src/server/ReactPartialRenderer.js
-2
@@ -30,7 +30,6 @@ import {
30
REACT_FORWARD_REF_TYPE,
31
REACT_FRAGMENT_TYPE,
32
REACT_STRICT_MODE_TYPE,
33
- REACT_CONCURRENT_MODE_TYPE,
33
REACT_SUSPENSE_TYPE,
34
REACT_SUSPENSE_LIST_TYPE,
35
REACT_PORTAL_TYPE,
@@ -993,7 +992,6 @@ class ReactDOMServerRenderer {
992
993
switch (elementType) {
994
case REACT_STRICT_MODE_TYPE:
996
- case REACT_CONCURRENT_MODE_TYPE:
995
case REACT_PROFILER_TYPE:
996
case REACT_SUSPENSE_LIST_TYPE:
997
case REACT_FRAGMENT_TYPE: {
packages/react-is/src/ReactIs.js
+14
-11
@@ -10,8 +10,6 @@
10
'use strict';
11
12
import {
13
- REACT_ASYNC_MODE_TYPE,
14
- REACT_CONCURRENT_MODE_TYPE,
13
REACT_CONTEXT_TYPE,
14
REACT_ELEMENT_TYPE,
15
REACT_FORWARD_REF_TYPE,
@@ -34,8 +32,6 @@ export function typeOf(object: any) {
32
const type = object.type;
33
34
switch (type) {
37
- case REACT_ASYNC_MODE_TYPE:
38
- case REACT_CONCURRENT_MODE_TYPE:
35
case REACT_FRAGMENT_TYPE:
36
case REACT_PROFILER_TYPE:
37
case REACT_STRICT_MODE_TYPE:
@@ -63,9 +59,6 @@ export function typeOf(object: any) {
59
return undefined;
60
}
61
66
-// AsyncMode is deprecated along with isAsyncMode
67
-export const AsyncMode = REACT_ASYNC_MODE_TYPE;
68
-export const ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
62
export const ContextConsumer = REACT_CONTEXT_TYPE;
63
export const ContextProvider = REACT_PROVIDER_TYPE;
64
export const Element = REACT_ELEMENT_TYPE;
@@ -81,6 +74,7 @@ export const Suspense = REACT_SUSPENSE_TYPE;
74
export {isValidElementType};
75
76
let hasWarnedAboutDeprecatedIsAsyncMode = false;
77
+let hasWarnedAboutDeprecatedIsConcurrentMode = false;
78
79
// AsyncMode should be deprecated
80
export function isAsyncMode(object: any) {
@@ -90,15 +84,24 @@ export function isAsyncMode(object: any) {
84
// Using console['warn'] to evade Babel and ESLint
85
console['warn'](
86
'The ReactIs.isAsyncMode() alias has been deprecated, ' +
93
- 'and will be removed in React 17+. Update your code to use ' +
94
- 'ReactIs.isConcurrentMode() instead. It has the exact same API.',
87
+ 'and will be removed in React 17+.',
88
);
89
}
90
}
98
- return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
91
+ return false;
92
}
93
export function isConcurrentMode(object: any) {
101
- return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
94
+ if (__DEV__) {
95
+ if (!hasWarnedAboutDeprecatedIsConcurrentMode) {
96
+ hasWarnedAboutDeprecatedIsConcurrentMode = true;
97
+ // Using console['warn'] to evade Babel and ESLint
98
+ console['warn'](
99
+ 'The ReactIs.isConcurrentMode() alias has been deprecated, ' +
100
+ 'and will be removed in React 17+.',
101
+ );
102
+ }
103
+ }
104
+ return false;
105
}
106
export function isContextConsumer(object: any) {
107
return typeOf(object) === REACT_CONTEXT_TYPE;
packages/react-reconciler/src/ReactFiber.js
-5
@@ -84,7 +84,6 @@ import {
84
REACT_PROFILER_TYPE,
85
REACT_PROVIDER_TYPE,
86
REACT_CONTEXT_TYPE,
87
- REACT_CONCURRENT_MODE_TYPE,
87
REACT_SUSPENSE_TYPE,
88
REACT_SUSPENSE_LIST_TYPE,
89
REACT_MEMO_TYPE,
@@ -638,10 +637,6 @@ export function createFiberFromTypeAndProps(
637
expirationTime,
638
key,
639
);
641
- case REACT_CONCURRENT_MODE_TYPE:
642
- fiberTag = Mode;
643
- mode |= ConcurrentMode | BlockingMode | StrictMode;
644
- break;
640
case REACT_STRICT_MODE_TYPE:
641
fiberTag = Mode;
642
mode |= StrictMode;
packages/shared/ReactSymbols.js
-8
@@ -32,14 +32,6 @@ export const REACT_PROVIDER_TYPE = hasSymbol
32
export const REACT_CONTEXT_TYPE = hasSymbol
33
? Symbol.for('react.context')
34
: 0xeace;
35
-// TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
36
-// (unstable) APIs that have been removed. Can we remove the symbols?
37
-export const REACT_ASYNC_MODE_TYPE = hasSymbol
38
- ? Symbol.for('react.async_mode')
39
- : 0xeacf;
40
-export const REACT_CONCURRENT_MODE_TYPE = hasSymbol
41
- ? Symbol.for('react.concurrent_mode')
42
- : 0xeacf;
35
export const REACT_FORWARD_REF_TYPE = hasSymbol
36
? Symbol.for('react.forward_ref')
37
: 0xead0;
packages/shared/isValidElementType.js
-2
@@ -8,7 +8,6 @@
8
*/
9
10
import {
11
- REACT_CONCURRENT_MODE_TYPE,
11
REACT_CONTEXT_TYPE,
12
REACT_FORWARD_REF_TYPE,
13
REACT_FRAGMENT_TYPE,
@@ -32,7 +31,6 @@ export default function isValidElementType(type: mixed) {
31
typeof type === 'function' ||
32
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
33
type === REACT_FRAGMENT_TYPE ||
35
- type === REACT_CONCURRENT_MODE_TYPE ||
34
type === REACT_PROFILER_TYPE ||
35
type === REACT_STRICT_MODE_TYPE ||
36
type === REACT_SUSPENSE_TYPE ||