(returnFiber, oldFiber, newChild, expirationTime)
| 8475 | } |
| 8476 | |
| 8477 | function updateSlot(returnFiber, oldFiber, newChild, expirationTime) { |
| 8478 | // Update the fiber if the keys match, otherwise return null. |
| 8479 | |
| 8480 | var key = oldFiber !== null ? oldFiber.key : null; |
| 8481 | |
| 8482 | if (typeof newChild === 'string' || typeof newChild === 'number') { |
| 8483 | // Text nodes don't have keys. If the previous node is implicitly keyed |
| 8484 | // we can continue to replace it without aborting even if it is not a text |
| 8485 | // node. |
| 8486 | if (key !== null) { |
| 8487 | return null; |
| 8488 | } |
| 8489 | return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime); |
| 8490 | } |
| 8491 | |
| 8492 | if (typeof newChild === 'object' && newChild !== null) { |
| 8493 | switch (newChild.$$typeof) { |
| 8494 | case REACT_ELEMENT_TYPE: |
| 8495 | { |
| 8496 | if (newChild.key === key) { |
| 8497 | if (newChild.type === REACT_FRAGMENT_TYPE) { |
| 8498 | return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key); |
| 8499 | } |
| 8500 | return updateElement(returnFiber, oldFiber, newChild, expirationTime); |
| 8501 | } else { |
| 8502 | return null; |
| 8503 | } |
| 8504 | } |
| 8505 | case REACT_PORTAL_TYPE: |
| 8506 | { |
| 8507 | if (newChild.key === key) { |
| 8508 | return updatePortal(returnFiber, oldFiber, newChild, expirationTime); |
| 8509 | } else { |
| 8510 | return null; |
| 8511 | } |
| 8512 | } |
| 8513 | } |
| 8514 | |
| 8515 | if (isArray$1(newChild) || getIteratorFn(newChild)) { |
| 8516 | if (key !== null) { |
| 8517 | return null; |
| 8518 | } |
| 8519 | |
| 8520 | return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null); |
| 8521 | } |
| 8522 | |
| 8523 | throwOnInvalidObjectType(returnFiber, newChild); |
| 8524 | } |
| 8525 | |
| 8526 | { |
| 8527 | if (typeof newChild === 'function') { |
| 8528 | warnOnFunctionType(); |
| 8529 | } |
| 8530 | } |
| 8531 | |
| 8532 | return null; |
| 8533 | } |
| 8534 |
no test coverage detected