@@ -18,6 +18,7 @@ import type {Thenable} from 'react-reconciler/src/ReactFiberScheduler';
18
18
import type { Fiber } from 'react-reconciler/src/ReactFiber' ;
19
19
import type { UpdateQueue } from 'react-reconciler/src/ReactUpdateQueue' ;
20
20
import type { ReactNodeList } from 'shared/ReactTypes' ;
21
+ import type { RootTag } from 'shared/ReactRootTags' ;
21
22
22
23
import * as Scheduler from 'scheduler/unstable_mock' ;
23
24
import { createPortal } from 'shared/ReactPortal' ;
@@ -32,6 +33,7 @@ import enqueueTask from 'shared/enqueueTask';
32
33
import ReactSharedInternals from 'shared/ReactSharedInternals' ;
33
34
import warningWithoutStack from 'shared/warningWithoutStack' ;
34
35
import { enableEventAPI } from 'shared/ReactFeatureFlags' ;
36
+ import { ConcurrentRoot , BatchedRoot , LegacyRoot } from 'shared/ReactRootTags' ;
35
37
36
38
type EventTargetChildElement = {
37
39
type : string ,
@@ -901,39 +903,27 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
901
903
return getPendingChildren ( container ) ;
902
904
} ,
903
905
904
- getOrCreateRootContainer (
905
- rootID : string = DEFAULT_ROOT_ID ,
906
- isBatched : boolean ,
907
- isConcurrent : boolean ,
908
- ) {
906
+ getOrCreateRootContainer ( rootID : string = DEFAULT_ROOT_ID , tag : RootTag ) {
909
907
let root = roots . get ( rootID ) ;
910
908
if ( ! root ) {
911
909
const container = { rootID : rootID , pendingChildren : [ ] , children : [ ] } ;
912
910
rootContainers . set ( rootID , container ) ;
913
- root = NoopRenderer . createContainer (
914
- container ,
915
- isBatched ,
916
- isConcurrent ,
917
- false ,
918
- ) ;
911
+ root = NoopRenderer . createContainer ( container , tag , false ) ;
919
912
roots . set ( rootID , root ) ;
920
913
}
921
914
return root . current . stateNode . containerInfo ;
922
915
} ,
923
916
924
917
// TODO: Replace ReactNoop.render with createRoot + root.render
925
918
createRoot ( ) {
926
- const isBatched = true ;
927
- const isConcurrent = true ;
928
919
const container = {
929
920
rootID : '' + idCounter ++ ,
930
921
pendingChildren : [ ] ,
931
922
children : [ ] ,
932
923
} ;
933
924
const fiberRoot = NoopRenderer . createContainer (
934
925
container ,
935
- isBatched ,
936
- isConcurrent ,
926
+ ConcurrentRoot ,
937
927
false ,
938
928
) ;
939
929
return {
@@ -951,17 +941,14 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
951
941
} ,
952
942
953
943
createSyncRoot ( ) {
954
- const isBatched = true ;
955
- const isConcurrent = false ;
956
944
const container = {
957
945
rootID : '' + idCounter ++ ,
958
946
pendingChildren : [ ] ,
959
947
children : [ ] ,
960
948
} ;
961
949
const fiberRoot = NoopRenderer . createContainer (
962
950
container ,
963
- isBatched ,
964
- isConcurrent ,
951
+ BatchedRoot ,
965
952
false ,
966
953
) ;
967
954
return {
@@ -1003,13 +990,7 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
1003
990
1004
991
renderLegacySyncRoot ( element : React$Element < any > , callback : ?Function ) {
1005
992
const rootID = DEFAULT_ROOT_ID ;
1006
- const isBatched = false ;
1007
- const isConcurrent = false ;
1008
- const container = ReactNoop . getOrCreateRootContainer (
1009
- rootID ,
1010
- isBatched ,
1011
- isConcurrent ,
1012
- ) ;
993
+ const container = ReactNoop . getOrCreateRootContainer ( rootID , LegacyRoot ) ;
1013
994
const root = roots . get ( container . rootID ) ;
1014
995
NoopRenderer . updateContainer ( element , root , null , callback ) ;
1015
996
} ,
@@ -1019,12 +1000,9 @@ function createReactNoop(reconciler: Function, useMutation: boolean) {
1019
1000
rootID : string ,
1020
1001
callback : ?Function ,
1021
1002
) {
1022
- const isBatched = true ;
1023
- const isConcurrent = true ;
1024
1003
const container = ReactNoop . getOrCreateRootContainer (
1025
1004
rootID ,
1026
- isBatched ,
1027
- isConcurrent ,
1005
+ ConcurrentRoot ,
1028
1006
) ;
1029
1007
const root = roots . get ( container . rootID ) ;
1030
1008
NoopRenderer . updateContainer ( element , root , null , callback ) ;
0 commit comments