Skip to content

Commit e2c6702

Browse files
authored
Remove ConcurrentMode and AsyncMode symbols (#18450)
This API was never released.
1 parent d6d5f5a commit e2c6702

File tree

6 files changed

+14
-33
lines changed

6 files changed

+14
-33
lines changed

packages/react-devtools-shared/src/utils.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import LRU from 'lru-cache';
1111
import {
1212
isElement,
1313
typeOf,
14-
AsyncMode,
15-
ConcurrentMode,
1614
ContextConsumer,
1715
ContextProvider,
1816
ForwardRef,
@@ -424,9 +422,6 @@ export function getDisplayNameForReactElement(
424422
): string | null {
425423
const elementType = typeOf(element);
426424
switch (elementType) {
427-
case AsyncMode:
428-
case ConcurrentMode:
429-
return 'ConcurrentMode';
430425
case ContextConsumer:
431426
return 'ContextConsumer';
432427
case ContextProvider:

packages/react-dom/src/server/ReactPartialRenderer.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import {
3030
REACT_FORWARD_REF_TYPE,
3131
REACT_FRAGMENT_TYPE,
3232
REACT_STRICT_MODE_TYPE,
33-
REACT_CONCURRENT_MODE_TYPE,
3433
REACT_SUSPENSE_TYPE,
3534
REACT_SUSPENSE_LIST_TYPE,
3635
REACT_PORTAL_TYPE,
@@ -993,7 +992,6 @@ class ReactDOMServerRenderer {
993992

994993
switch (elementType) {
995994
case REACT_STRICT_MODE_TYPE:
996-
case REACT_CONCURRENT_MODE_TYPE:
997995
case REACT_PROFILER_TYPE:
998996
case REACT_SUSPENSE_LIST_TYPE:
999997
case REACT_FRAGMENT_TYPE: {

packages/react-is/src/ReactIs.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
'use strict';
1111

1212
import {
13-
REACT_ASYNC_MODE_TYPE,
14-
REACT_CONCURRENT_MODE_TYPE,
1513
REACT_CONTEXT_TYPE,
1614
REACT_ELEMENT_TYPE,
1715
REACT_FORWARD_REF_TYPE,
@@ -34,8 +32,6 @@ export function typeOf(object: any) {
3432
const type = object.type;
3533

3634
switch (type) {
37-
case REACT_ASYNC_MODE_TYPE:
38-
case REACT_CONCURRENT_MODE_TYPE:
3935
case REACT_FRAGMENT_TYPE:
4036
case REACT_PROFILER_TYPE:
4137
case REACT_STRICT_MODE_TYPE:
@@ -63,9 +59,6 @@ export function typeOf(object: any) {
6359
return undefined;
6460
}
6561

66-
// AsyncMode is deprecated along with isAsyncMode
67-
export const AsyncMode = REACT_ASYNC_MODE_TYPE;
68-
export const ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
6962
export const ContextConsumer = REACT_CONTEXT_TYPE;
7063
export const ContextProvider = REACT_PROVIDER_TYPE;
7164
export const Element = REACT_ELEMENT_TYPE;
@@ -81,6 +74,7 @@ export const Suspense = REACT_SUSPENSE_TYPE;
8174
export {isValidElementType};
8275

8376
let hasWarnedAboutDeprecatedIsAsyncMode = false;
77+
let hasWarnedAboutDeprecatedIsConcurrentMode = false;
8478

8579
// AsyncMode should be deprecated
8680
export function isAsyncMode(object: any) {
@@ -90,15 +84,24 @@ export function isAsyncMode(object: any) {
9084
// Using console['warn'] to evade Babel and ESLint
9185
console['warn'](
9286
'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+.',
9588
);
9689
}
9790
}
98-
return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
91+
return false;
9992
}
10093
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;
102105
}
103106
export function isContextConsumer(object: any) {
104107
return typeOf(object) === REACT_CONTEXT_TYPE;

packages/react-reconciler/src/ReactFiber.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ import {
8484
REACT_PROFILER_TYPE,
8585
REACT_PROVIDER_TYPE,
8686
REACT_CONTEXT_TYPE,
87-
REACT_CONCURRENT_MODE_TYPE,
8887
REACT_SUSPENSE_TYPE,
8988
REACT_SUSPENSE_LIST_TYPE,
9089
REACT_MEMO_TYPE,
@@ -638,10 +637,6 @@ export function createFiberFromTypeAndProps(
638637
expirationTime,
639638
key,
640639
);
641-
case REACT_CONCURRENT_MODE_TYPE:
642-
fiberTag = Mode;
643-
mode |= ConcurrentMode | BlockingMode | StrictMode;
644-
break;
645640
case REACT_STRICT_MODE_TYPE:
646641
fiberTag = Mode;
647642
mode |= StrictMode;

packages/shared/ReactSymbols.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,6 @@ export const REACT_PROVIDER_TYPE = hasSymbol
3232
export const REACT_CONTEXT_TYPE = hasSymbol
3333
? Symbol.for('react.context')
3434
: 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;
4335
export const REACT_FORWARD_REF_TYPE = hasSymbol
4436
? Symbol.for('react.forward_ref')
4537
: 0xead0;

packages/shared/isValidElementType.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
*/
99

1010
import {
11-
REACT_CONCURRENT_MODE_TYPE,
1211
REACT_CONTEXT_TYPE,
1312
REACT_FORWARD_REF_TYPE,
1413
REACT_FRAGMENT_TYPE,
@@ -32,7 +31,6 @@ export default function isValidElementType(type: mixed) {
3231
typeof type === 'function' ||
3332
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
3433
type === REACT_FRAGMENT_TYPE ||
35-
type === REACT_CONCURRENT_MODE_TYPE ||
3634
type === REACT_PROFILER_TYPE ||
3735
type === REACT_STRICT_MODE_TYPE ||
3836
type === REACT_SUSPENSE_TYPE ||

0 commit comments

Comments
 (0)