File tree Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Expand file tree Collapse file tree 3 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 10
10
'use strict' ;
11
11
12
12
import {
13
+ REACT_ASYNC_MODE_TYPE ,
13
14
REACT_CONCURRENT_MODE_TYPE ,
14
15
REACT_CONTEXT_TYPE ,
15
16
REACT_ELEMENT_TYPE ,
@@ -32,6 +33,7 @@ export function typeOf(object: any) {
32
33
const type = object . type ;
33
34
34
35
switch ( type ) {
36
+ case REACT_ASYNC_MODE_TYPE :
35
37
case REACT_CONCURRENT_MODE_TYPE :
36
38
case REACT_FRAGMENT_TYPE :
37
39
case REACT_PROFILER_TYPE :
@@ -57,8 +59,8 @@ export function typeOf(object: any) {
57
59
return undefined ;
58
60
}
59
61
60
- // AsyncMode alias is deprecated along with isAsyncMode
61
- export const AsyncMode = REACT_CONCURRENT_MODE_TYPE ;
62
+ // AsyncMode is deprecated along with isAsyncMode
63
+ export const AsyncMode = REACT_ASYNC_MODE_TYPE ;
62
64
export const ConcurrentMode = REACT_CONCURRENT_MODE_TYPE ;
63
65
export const ContextConsumer = REACT_CONTEXT_TYPE ;
64
66
export const ContextProvider = REACT_PROVIDER_TYPE ;
@@ -86,7 +88,7 @@ export function isAsyncMode(object: any) {
86
88
) ;
87
89
}
88
90
}
89
- return isConcurrentMode ( object ) ;
91
+ return isConcurrentMode ( object ) || typeOf ( object ) === REACT_ASYNC_MODE_TYPE ;
90
92
}
91
93
export function isConcurrentMode ( object : any ) {
92
94
return typeOf ( object ) === REACT_CONCURRENT_MODE_TYPE ;
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ describe('ReactIs', () => {
69
69
expect ( ReactIs . isValidElementType ( { type : 'div' , props : { } } ) ) . toEqual ( false ) ;
70
70
} ) ;
71
71
72
- it ( 'should identify async mode' , ( ) => {
72
+ it ( 'should identify concurrent mode' , ( ) => {
73
73
expect ( ReactIs . typeOf ( < React . unstable_ConcurrentMode /> ) ) . toBe (
74
74
ReactIs . ConcurrentMode ,
75
75
) ;
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ export const REACT_PROVIDER_TYPE = hasSymbol
32
32
export const REACT_CONTEXT_TYPE = hasSymbol
33
33
? Symbol . for ( 'react.context' )
34
34
: 0xeace ;
35
+ export const REACT_ASYNC_MODE_TYPE = hasSymbol
36
+ ? Symbol . for ( 'react.async_mode' )
37
+ : 0xeacf ;
35
38
export const REACT_CONCURRENT_MODE_TYPE = hasSymbol
36
39
? Symbol . for ( 'react.concurrent_mode' )
37
40
: 0xeacf ;
You can’t perform that action at this time.
0 commit comments