@@ -292,26 +292,30 @@ function scheduleFibersWithFamiliesRecursively(
292292 }
293293}
294294
295- export function findHostNodesForHotUpdate (
295+ export function findHostInstancesForHotUpdate (
296296 root : FiberRoot ,
297297 families : Array < Family > ,
298298) : Set < Instance > {
299299 if ( __DEV__ ) {
300- const hostNodes = new Set ( ) ;
300+ const hostInstances = new Set ( ) ;
301301 const types = new Set ( families . map ( family => family . current ) ) ;
302- findHostNodesForMatchingFibersRecursively ( root . current , types , hostNodes ) ;
303- return hostNodes ;
302+ findHostInstancesForMatchingFibersRecursively (
303+ root . current ,
304+ types ,
305+ hostInstances ,
306+ ) ;
307+ return hostInstances ;
304308 } else {
305309 throw new Error (
306- 'Did not expect findHostNodesForHotUpdate to be called in production.' ,
310+ 'Did not expect findHostInstancesForHotUpdate to be called in production.' ,
307311 ) ;
308312 }
309313}
310314
311- function findHostNodesForMatchingFibersRecursively (
315+ function findHostInstancesForMatchingFibersRecursively (
312316 fiber : Fiber ,
313317 types : Set < any > ,
314- hostNodes : Set < Instance > ,
318+ hostInstances : Set < Instance > ,
315319) {
316320 if ( __DEV__ ) {
317321 const { child, sibling, tag, type} = fiber ;
@@ -341,44 +345,52 @@ function findHostNodesForMatchingFibersRecursively(
341345 // We have a match. This only drills down to the closest host components.
342346 // There's no need to search deeper because for the purpose of giving
343347 // visual feedback, "flashing" outermost parent rectangles is sufficient.
344- findHostNodesForFiberShallowly ( fiber , hostNodes ) ;
348+ findHostInstancesForFiberShallowly ( fiber , hostInstances ) ;
345349 } else {
346350 // If there's no match, maybe there will be one further down in the child tree.
347351 if ( child !== null ) {
348- findHostNodesForMatchingFibersRecursively ( child , types , hostNodes ) ;
352+ findHostInstancesForMatchingFibersRecursively (
353+ child ,
354+ types ,
355+ hostInstances ,
356+ ) ;
349357 }
350358 }
351359
352360 if ( sibling !== null ) {
353- findHostNodesForMatchingFibersRecursively ( sibling , types , hostNodes ) ;
361+ findHostInstancesForMatchingFibersRecursively (
362+ sibling ,
363+ types ,
364+ hostInstances ,
365+ ) ;
354366 }
355367 }
356368}
357369
358- function findHostNodesForFiberShallowly (
370+ function findHostInstancesForFiberShallowly (
359371 fiber : Fiber ,
360- hostNodes : Set < Instance > ,
372+ hostInstances : Set < Instance > ,
361373) : void {
362374 if ( __DEV__ ) {
363- const foundHostNodes = findChildHostNodesForFiberShallowly (
375+ const foundHostInstances = findChildHostInstancesForFiberShallowly (
364376 fiber ,
365- hostNodes ,
377+ hostInstances ,
366378 ) ;
367- if ( foundHostNodes ) {
379+ if ( foundHostInstances ) {
368380 return ;
369381 }
370382 // If we didn't find any host children, fallback to closest host parent.
371383 let node = fiber ;
372384 while ( true ) {
373385 switch ( node . tag ) {
374386 case HostComponent :
375- hostNodes . add ( node . stateNode ) ;
387+ hostInstances . add ( node . stateNode ) ;
376388 return ;
377389 case HostPortal :
378- hostNodes . add ( node . stateNode . containerInfo ) ;
390+ hostInstances . add ( node . stateNode . containerInfo ) ;
379391 return ;
380392 case HostRoot :
381- hostNodes . add ( node . stateNode . containerInfo ) ;
393+ hostInstances . add ( node . stateNode . containerInfo ) ;
382394 return ;
383395 }
384396 if ( node . return === null ) {
@@ -389,30 +401,30 @@ function findHostNodesForFiberShallowly(
389401 }
390402}
391403
392- function findChildHostNodesForFiberShallowly (
404+ function findChildHostInstancesForFiberShallowly (
393405 fiber : Fiber ,
394- hostNodes : Set < Instance > ,
406+ hostInstances : Set < Instance > ,
395407) : boolean {
396408 if ( __DEV__ ) {
397409 let node : Fiber = fiber ;
398- let foundHostNodes = false ;
410+ let foundHostInstances = false ;
399411 while ( true ) {
400412 if ( node . tag === HostComponent ) {
401413 // We got a match.
402- foundHostNodes = true ;
403- hostNodes . add ( node . stateNode ) ;
414+ foundHostInstances = true ;
415+ hostInstances . add ( node . stateNode ) ;
404416 // There may still be more, so keep searching.
405417 } else if ( node . child !== null ) {
406418 node . child . return = node ;
407419 node = node . child ;
408420 continue ;
409421 }
410422 if ( node === fiber ) {
411- return foundHostNodes ;
423+ return foundHostInstances ;
412424 }
413425 while ( node . sibling === null ) {
414426 if ( node . return === null || node . return === fiber ) {
415- return foundHostNodes ;
427+ return foundHostInstances ;
416428 }
417429 node = node . return ;
418430 }
0 commit comments