@@ -16,7 +16,6 @@ import type {
1616 Props ,
1717 Container ,
1818 ChildSet ,
19- HostContext ,
2019} from './ReactFiberHostConfig' ;
2120
2221import {
@@ -51,10 +50,8 @@ import {
5150import invariant from 'shared/invariant' ;
5251
5352import {
54- getRootHostContext ,
5553 createInstance ,
5654 createTextInstance ,
57- createHiddenTextInstance ,
5855 appendInitialChild ,
5956 finalizeInitialChildren ,
6057 prepareUpdate ,
@@ -63,6 +60,8 @@ import {
6360 cloneInstance ,
6461 cloneHiddenInstance ,
6562 cloneUnhiddenInstance ,
63+ cloneHiddenTextInstance ,
64+ cloneUnhiddenTextInstance ,
6665 createContainerChildSet ,
6766 appendChildToContainerChildSet ,
6867 finalizeContainerChildren ,
@@ -107,8 +106,6 @@ if (supportsMutation) {
107106 appendAllChildren = function (
108107 parent : Instance ,
109108 workInProgress : Fiber ,
110- rootContainerInstance : Container ,
111- childHostContext : HostContext ,
112109 needsVisibilityToggle : boolean ,
113110 isHidden : boolean ,
114111 ) {
@@ -141,11 +138,7 @@ if (supportsMutation) {
141138 }
142139 } ;
143140
144- updateHostContainer = function (
145- workInProgress : Fiber ,
146- rootContainerInstance : Container ,
147- childHostContext : HostContext ,
148- ) {
141+ updateHostContainer = function ( workInProgress : Fiber ) {
149142 // Noop
150143 } ;
151144 updateHostComponent = function (
@@ -154,7 +147,6 @@ if (supportsMutation) {
154147 type : Type ,
155148 newProps : Props ,
156149 rootContainerInstance : Container ,
157- childHostContext : HostContext ,
158150 ) {
159151 // If we have an alternate, that means this is an update and we need to
160152 // schedule a side-effect to do the updates.
@@ -207,8 +199,6 @@ if (supportsMutation) {
207199 appendAllChildren = function (
208200 parent : Instance ,
209201 workInProgress : Fiber ,
210- rootContainerInstance : Container ,
211- childHostContext : HostContext ,
212202 needsVisibilityToggle : boolean ,
213203 isHidden : boolean ,
214204 ) {
@@ -239,19 +229,9 @@ if (supportsMutation) {
239229 if ( needsVisibilityToggle ) {
240230 const text = node . memoizedProps ;
241231 if ( isHidden ) {
242- instance = createHiddenTextInstance (
243- text ,
244- rootContainerInstance ,
245- childHostContext ,
246- workInProgress ,
247- ) ;
232+ instance = cloneHiddenTextInstance ( instance , text , node ) ;
248233 } else {
249- instance = createTextInstance (
250- text ,
251- rootContainerInstance ,
252- childHostContext ,
253- workInProgress ,
254- ) ;
234+ instance = cloneUnhiddenTextInstance ( instance , text , node ) ;
255235 }
256236 node . stateNode = instance ;
257237 }
@@ -267,27 +247,13 @@ if (supportsMutation) {
267247 if ( newIsHidden ) {
268248 const primaryChildParent = node . child ;
269249 if ( primaryChildParent !== null ) {
270- appendAllChildren (
271- parent ,
272- primaryChildParent ,
273- rootContainerInstance ,
274- childHostContext ,
275- true ,
276- newIsHidden ,
277- ) ;
250+ appendAllChildren ( parent , primaryChildParent , true , newIsHidden ) ;
278251 node = primaryChildParent . sibling ;
279252 continue ;
280253 }
281254 } else {
282255 const primaryChildParent = node ;
283- appendAllChildren (
284- parent ,
285- primaryChildParent ,
286- rootContainerInstance ,
287- childHostContext ,
288- true ,
289- newIsHidden ,
290- ) ;
256+ appendAllChildren ( parent , primaryChildParent , true , newIsHidden ) ;
291257 // eslint-disable-next-line no-labels
292258 break branches;
293259 }
@@ -323,8 +289,6 @@ if (supportsMutation) {
323289 const appendAllChildrenToContainer = function (
324290 containerChildSet : ChildSet ,
325291 workInProgress : Fiber ,
326- rootContainerInstance : Container ,
327- rootHostContext : HostContext ,
328292 needsVisibilityToggle : boolean ,
329293 isHidden : boolean ,
330294 ) {
@@ -355,19 +319,9 @@ if (supportsMutation) {
355319 if ( needsVisibilityToggle ) {
356320 const text = node . memoizedProps ;
357321 if ( isHidden ) {
358- instance = createHiddenTextInstance (
359- text ,
360- rootContainerInstance ,
361- rootHostContext ,
362- workInProgress ,
363- ) ;
322+ instance = cloneHiddenTextInstance ( instance , text , node ) ;
364323 } else {
365- instance = createTextInstance (
366- text ,
367- rootContainerInstance ,
368- rootHostContext ,
369- workInProgress ,
370- ) ;
324+ instance = cloneUnhiddenTextInstance ( instance , text , node ) ;
371325 }
372326 node . stateNode = instance ;
373327 }
@@ -386,8 +340,6 @@ if (supportsMutation) {
386340 appendAllChildrenToContainer (
387341 containerChildSet ,
388342 primaryChildParent ,
389- rootContainerInstance ,
390- rootHostContext ,
391343 true ,
392344 newIsHidden ,
393345 ) ;
@@ -399,8 +351,6 @@ if (supportsMutation) {
399351 appendAllChildrenToContainer (
400352 containerChildSet ,
401353 primaryChildParent ,
402- rootContainerInstance ,
403- rootHostContext ,
404354 true ,
405355 newIsHidden ,
406356 ) ;
@@ -434,11 +384,7 @@ if (supportsMutation) {
434384 node = node . sibling ;
435385 }
436386 } ;
437- updateHostContainer = function (
438- workInProgress : Fiber ,
439- rootContainerInstance : Container ,
440- rootHostContext : HostContext ,
441- ) {
387+ updateHostContainer = function ( workInProgress : Fiber ) {
442388 const portalOrRoot : {
443389 containerInfo : Container ,
444390 pendingChildren : ChildSet ,
@@ -451,14 +397,7 @@ if (supportsMutation) {
451397 const container = portalOrRoot . containerInfo ;
452398 let newChildSet = createContainerChildSet ( container ) ;
453399 // If children might have changed, we have to add them all to the set.
454- appendAllChildrenToContainer (
455- newChildSet ,
456- workInProgress ,
457- rootContainerInstance ,
458- rootHostContext ,
459- false ,
460- false ,
461- ) ;
400+ appendAllChildrenToContainer ( newChildSet , workInProgress , false , false ) ;
462401 portalOrRoot . pendingChildren = newChildSet ;
463402 // Schedule an update on the container to swap out the container.
464403 markUpdate ( workInProgress ) ;
@@ -471,7 +410,6 @@ if (supportsMutation) {
471410 type : Type ,
472411 newProps : Props ,
473412 rootContainerInstance : Container ,
474- childHostContext : HostContext ,
475413 ) {
476414 const currentInstance = current . stateNode ;
477415 const oldProps = current . memoizedProps ;
@@ -532,14 +470,7 @@ if (supportsMutation) {
532470 markUpdate ( workInProgress ) ;
533471 } else {
534472 // If children might have changed, we have to add them all to the set.
535- appendAllChildren (
536- newInstance ,
537- workInProgress ,
538- rootContainerInstance ,
539- childHostContext ,
540- false ,
541- false ,
542- ) ;
473+ appendAllChildren ( newInstance , workInProgress , false , false ) ;
543474 }
544475 } ;
545476 updateHostText = function (
@@ -565,11 +496,7 @@ if (supportsMutation) {
565496 } ;
566497} else {
567498 // No host operations
568- updateHostContainer = function (
569- workInProgress : Fiber ,
570- rootContainerInstance : Container ,
571- hostContext : HostContext ,
572- ) {
499+ updateHostContainer = function ( workInProgress : Fiber ) {
573500 // Noop
574501 } ;
575502 updateHostComponent = function (
@@ -578,7 +505,6 @@ if (supportsMutation) {
578505 type : Type ,
579506 newProps : Props ,
580507 rootContainerInstance : Container ,
581- childHostContext : HostContext ,
582508 ) {
583509 // Noop
584510 } ;
@@ -630,19 +556,12 @@ function completeWork(
630556 // TODO: Delete this when we delete isMounted and findDOMNode.
631557 workInProgress . effectTag &= ~ Placement ;
632558 }
633- const rootContainerInstance = fiberRoot . containerInfo ;
634- const rootHostContext = getRootHostContext ( rootContainerInstance ) ;
635- updateHostContainer (
636- workInProgress ,
637- rootContainerInstance ,
638- rootHostContext ,
639- ) ;
559+ updateHostContainer ( workInProgress ) ;
640560 break ;
641561 }
642562 case HostComponent : {
643- const rootContainerInstance = getRootHostContainer ( ) ;
644- const childHostContext = getHostContext ( ) ;
645563 popHostContext ( workInProgress ) ;
564+ const rootContainerInstance = getRootHostContainer ( ) ;
646565 const type = workInProgress . type ;
647566 if ( current !== null && workInProgress . stateNode != null ) {
648567 updateHostComponent (
@@ -651,7 +570,6 @@ function completeWork(
651570 type ,
652571 newProps ,
653572 rootContainerInstance ,
654- childHostContext ,
655573 ) ;
656574
657575 if ( current . ref !== workInProgress . ref ) {
@@ -697,14 +615,7 @@ function completeWork(
697615 workInProgress ,
698616 ) ;
699617
700- appendAllChildren (
701- instance ,
702- workInProgress ,
703- rootContainerInstance ,
704- childHostContext ,
705- false ,
706- false ,
707- ) ;
618+ appendAllChildren ( instance , workInProgress , false , false ) ;
708619
709620 // Certain renderers require commit-time effects for initial mount.
710621 // (eg DOM renderer supports auto-focus for certain elements).
@@ -818,14 +729,8 @@ function completeWork(
818729 case Profiler :
819730 break ;
820731 case HostPortal :
821- const rootContainerInstance = getRootHostContainer ( ) ;
822- const childHostContext = getHostContext ( ) ;
823732 popHostContainer ( workInProgress ) ;
824- updateHostContainer (
825- workInProgress ,
826- rootContainerInstance ,
827- childHostContext ,
828- ) ;
733+ updateHostContainer ( workInProgress ) ;
829734 break ;
830735 case ContextProvider :
831736 // Pop provider fiber
0 commit comments