@@ -75,7 +75,7 @@ export type HostConfig<T, P, I, TI, C, CX> = {
7575} ;
7676
7777export type Reconciler < C , I , TI > = {
78- mountContainer ( element : ReactNodeList , containerInfo : C , parentComponent : ? ReactComponent < any , any , any > ) : OpaqueNode ,
78+ createContainer ( containerInfo : C ) : OpaqueNode ,
7979 updateContainer ( element : ReactNodeList , container : OpaqueNode , parentComponent : ?ReactComponent < any , any, any > ) : void ,
8080 performWithPriority ( priorityLevel : PriorityLevel , fn : Function ) : void ,
8181 /* eslint-disable no-undef */
@@ -119,17 +119,10 @@ module.exports = function<T, P, I, TI, C, CX>(config : HostConfig<T, P, I, TI, C
119119
120120 return {
121121
122- mountContainer ( element : ReactNodeList , containerInfo : C , parentComponent : ?ReactComponent < any , any , any > , callback : ?Function ) : OpaqueNode {
123- const context = getContextForSubtree ( parentComponent ) ;
124- const root = createFiberRoot ( containerInfo , context ) ;
122+ createContainer ( containerInfo : C ) : OpaqueNode {
123+ const root = createFiberRoot ( containerInfo ) ;
125124 const current = root . current ;
126125
127- scheduleTopLevelUpdate ( current , element , callback ) ;
128-
129- if ( __DEV__ && ReactFiberInstrumentation . debugTool ) {
130- ReactFiberInstrumentation . debugTool . onMountContainer ( root ) ;
131- }
132-
133126 // It may seem strange that we don't return the root here, but that will
134127 // allow us to have containers that are in the middle of the tree instead
135128 // of being roots.
@@ -141,19 +134,26 @@ module.exports = function<T, P, I, TI, C, CX>(config : HostConfig<T, P, I, TI, C
141134 const root : FiberRoot = ( container . stateNode : any ) ;
142135 const current = root . current ;
143136
144- root . pendingContext = getContextForSubtree ( parentComponent ) ;
145-
146- scheduleTopLevelUpdate ( current , element , callback ) ;
147-
148137 if ( __DEV__ ) {
149138 if ( ReactFiberInstrumentation . debugTool ) {
150- if ( element === null ) {
139+ if ( current . alternate === null ) {
140+ ReactFiberInstrumentation . debugTool . onMountContainer ( root ) ;
141+ } else if ( element === null ) {
151142 ReactFiberInstrumentation . debugTool . onUnmountContainer ( root ) ;
152143 } else {
153144 ReactFiberInstrumentation . debugTool . onUpdateContainer ( root ) ;
154145 }
155146 }
156147 }
148+
149+ const context = getContextForSubtree ( parentComponent ) ;
150+ if ( root . context === null ) {
151+ root . context = context ;
152+ } else {
153+ root . pendingContext = context ;
154+ }
155+
156+ scheduleTopLevelUpdate ( current , element , context , callback ) ;
157157 } ,
158158
159159 performWithPriority ,
0 commit comments