(
returnFiber: Fiber,
currentFirstChild: Fiber | null,
element: ReactElement,
lanes: Lanes,
)
| 1632 | } |
| 1633 | |
| 1634 | function reconcileSingleElement( |
| 1635 | returnFiber: Fiber, |
| 1636 | currentFirstChild: Fiber | null, |
| 1637 | element: ReactElement, |
| 1638 | lanes: Lanes, |
| 1639 | ): Fiber { |
| 1640 | const key = element.key; |
| 1641 | let child = currentFirstChild; |
| 1642 | while (child !== null) { |
| 1643 | // TODO: If key === null and child.key === null, then this only applies to |
| 1644 | // the first item in the list. |
| 1645 | if (child.key === key) { |
| 1646 | const elementType = element.type; |
| 1647 | if (elementType === REACT_FRAGMENT_TYPE) { |
| 1648 | if (child.tag === Fragment) { |
| 1649 | deleteRemainingChildren(returnFiber, child.sibling); |
| 1650 | const existing = useFiber(child, element.props.children); |
| 1651 | if (enableFragmentRefs) { |
| 1652 | coerceRef(existing, element); |
| 1653 | } |
| 1654 | existing.return = returnFiber; |
| 1655 | if (__DEV__) { |
| 1656 | existing._debugOwner = element._owner; |
| 1657 | existing._debugInfo = currentDebugInfo; |
| 1658 | } |
| 1659 | validateFragmentProps(element, existing, returnFiber); |
| 1660 | return existing; |
| 1661 | } |
| 1662 | } else { |
| 1663 | if ( |
| 1664 | child.elementType === elementType || |
| 1665 | // Keep this check inline so it only runs on the false path: |
| 1666 | (__DEV__ |
| 1667 | ? isCompatibleFamilyForHotReloading(child, element) |
| 1668 | : false) || |
| 1669 | // Lazy types should reconcile their resolved type. |
| 1670 | // We need to do this after the Hot Reloading check above, |
| 1671 | // because hot reloading has different semantics than prod because |
| 1672 | // it doesn't resuspend. So we can't let the call below suspend. |
| 1673 | (typeof elementType === 'object' && |
| 1674 | elementType !== null && |
| 1675 | elementType.$$typeof === REACT_LAZY_TYPE && |
| 1676 | resolveLazy(elementType) === child.type) |
| 1677 | ) { |
| 1678 | deleteRemainingChildren(returnFiber, child.sibling); |
| 1679 | const existing = useFiber(child, element.props); |
| 1680 | coerceRef(existing, element); |
| 1681 | existing.return = returnFiber; |
| 1682 | if (__DEV__) { |
| 1683 | existing._debugOwner = element._owner; |
| 1684 | existing._debugInfo = currentDebugInfo; |
| 1685 | } |
| 1686 | return existing; |
| 1687 | } |
| 1688 | } |
| 1689 | // Didn't match. |
| 1690 | deleteRemainingChildren(returnFiber, child); |
| 1691 | break; |
no test coverage detected