( current: Fiber, workInProgress: Fiber, type: Type, newProps: Props, renderLanes: Lanes, )
| 451 | } |
| 452 | |
| 453 | function updateHostComponent( |
| 454 | current: Fiber, |
| 455 | workInProgress: Fiber, |
| 456 | type: Type, |
| 457 | newProps: Props, |
| 458 | renderLanes: Lanes, |
| 459 | ) { |
| 460 | if (supportsMutation) { |
| 461 | // If we have an alternate, that means this is an update and we need to |
| 462 | // schedule a side-effect to do the updates. |
| 463 | const oldProps = current.memoizedProps; |
| 464 | if (oldProps === newProps) { |
| 465 | // In mutation mode, this is sufficient for a bailout because |
| 466 | // we won't touch this node even if children changed. |
| 467 | return; |
| 468 | } |
| 469 | |
| 470 | markUpdate(workInProgress); |
| 471 | } else if (supportsPersistence) { |
| 472 | const currentInstance = current.stateNode; |
| 473 | const oldProps = current.memoizedProps; |
| 474 | // If there are no effects associated with this node, then none of our children had any updates. |
| 475 | // This guarantees that we can reuse all of them. |
| 476 | const requiresClone = doesRequireClone(current, workInProgress); |
| 477 | if (!requiresClone && oldProps === newProps) { |
| 478 | // No changes, just reuse the existing instance. |
| 479 | // Note that this might release a previous clone. |
| 480 | workInProgress.stateNode = currentInstance; |
| 481 | return; |
| 482 | } |
| 483 | const currentHostContext = getHostContext(); |
| 484 | |
| 485 | let newChildSet = null; |
| 486 | let hasOffscreenComponentChild = false; |
| 487 | if (requiresClone && passChildrenWhenCloningPersistedNodes) { |
| 488 | markCloned(workInProgress); |
| 489 | newChildSet = createContainerChildSet(); |
| 490 | // If children might have changed, we have to add them all to the set. |
| 491 | hasOffscreenComponentChild = appendAllChildrenToContainer( |
| 492 | newChildSet, |
| 493 | workInProgress, |
| 494 | /* needsVisibilityToggle */ false, |
| 495 | /* isHidden */ false, |
| 496 | ); |
| 497 | } |
| 498 | |
| 499 | const newInstance = cloneInstance( |
| 500 | currentInstance, |
| 501 | type, |
| 502 | oldProps, |
| 503 | newProps, |
| 504 | !requiresClone, |
| 505 | !hasOffscreenComponentChild ? newChildSet : undefined, |
| 506 | ); |
| 507 | if (newInstance === currentInstance) { |
| 508 | // No changes, just reuse the existing instance. |
| 509 | // Note that this might release a previous clone. |
| 510 | workInProgress.stateNode = currentInstance; |
no test coverage detected