(returnFiber, oldFiber, newChild, expirationTime)
| 8438 | } |
| 8439 | |
| 8440 | function updateSlot(returnFiber, oldFiber, newChild, expirationTime) { |
| 8441 | // Update the fiber if the keys match, otherwise return null. |
| 8442 | |
| 8443 | var key = oldFiber !== null ? oldFiber.key : null; |
| 8444 | |
| 8445 | if (typeof newChild === 'string' || typeof newChild === 'number') { |
| 8446 | // Text nodes don't have keys. If the previous node is implicitly keyed |
| 8447 | // we can continue to replace it without aborting even if it is not a text |
| 8448 | // node. |
| 8449 | if (key !== null) { |
| 8450 | return null; |
| 8451 | } |
| 8452 | return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime); |
| 8453 | } |
| 8454 | |
| 8455 | if (typeof newChild === 'object' && newChild !== null) { |
| 8456 | switch (newChild.$$typeof) { |
| 8457 | case REACT_ELEMENT_TYPE: |
| 8458 | { |
| 8459 | if (newChild.key === key) { |
| 8460 | if (newChild.type === REACT_FRAGMENT_TYPE) { |
| 8461 | return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key); |
| 8462 | } |
| 8463 | return updateElement(returnFiber, oldFiber, newChild, expirationTime); |
| 8464 | } else { |
| 8465 | return null; |
| 8466 | } |
| 8467 | } |
| 8468 | case REACT_PORTAL_TYPE: |
| 8469 | { |
| 8470 | if (newChild.key === key) { |
| 8471 | return updatePortal(returnFiber, oldFiber, newChild, expirationTime); |
| 8472 | } else { |
| 8473 | return null; |
| 8474 | } |
| 8475 | } |
| 8476 | } |
| 8477 | |
| 8478 | if (isArray$1(newChild) || getIteratorFn(newChild)) { |
| 8479 | if (key !== null) { |
| 8480 | return null; |
| 8481 | } |
| 8482 | |
| 8483 | return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null); |
| 8484 | } |
| 8485 | |
| 8486 | throwOnInvalidObjectType(returnFiber, newChild); |
| 8487 | } |
| 8488 | |
| 8489 | { |
| 8490 | if (typeof newChild === 'function') { |
| 8491 | warnOnFunctionType(); |
| 8492 | } |
| 8493 | } |
| 8494 | |
| 8495 | return null; |
| 8496 | } |
| 8497 |
no test coverage detected