(returnFiber, oldFiber, newChild, expirationTime)
| 9252 | } |
| 9253 | |
| 9254 | function updateSlot(returnFiber, oldFiber, newChild, expirationTime) { |
| 9255 | // Update the fiber if the keys match, otherwise return null. |
| 9256 | |
| 9257 | var key = oldFiber !== null ? oldFiber.key : null; |
| 9258 | |
| 9259 | if (typeof newChild === 'string' || typeof newChild === 'number') { |
| 9260 | // Text nodes don't have keys. If the previous node is implicitly keyed |
| 9261 | // we can continue to replace it without aborting even if it is not a text |
| 9262 | // node. |
| 9263 | if (key !== null) { |
| 9264 | return null; |
| 9265 | } |
| 9266 | return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime); |
| 9267 | } |
| 9268 | |
| 9269 | if (typeof newChild === 'object' && newChild !== null) { |
| 9270 | switch (newChild.$$typeof) { |
| 9271 | case REACT_ELEMENT_TYPE: |
| 9272 | { |
| 9273 | if (newChild.key === key) { |
| 9274 | if (newChild.type === REACT_FRAGMENT_TYPE) { |
| 9275 | return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key); |
| 9276 | } |
| 9277 | return updateElement(returnFiber, oldFiber, newChild, expirationTime); |
| 9278 | } else { |
| 9279 | return null; |
| 9280 | } |
| 9281 | } |
| 9282 | case REACT_PORTAL_TYPE: |
| 9283 | { |
| 9284 | if (newChild.key === key) { |
| 9285 | return updatePortal(returnFiber, oldFiber, newChild, expirationTime); |
| 9286 | } else { |
| 9287 | return null; |
| 9288 | } |
| 9289 | } |
| 9290 | } |
| 9291 | |
| 9292 | if (isArray$1(newChild) || getIteratorFn(newChild)) { |
| 9293 | if (key !== null) { |
| 9294 | return null; |
| 9295 | } |
| 9296 | |
| 9297 | return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null); |
| 9298 | } |
| 9299 | |
| 9300 | throwOnInvalidObjectType(returnFiber, newChild); |
| 9301 | } |
| 9302 | |
| 9303 | { |
| 9304 | if (typeof newChild === 'function') { |
| 9305 | warnOnFunctionType(); |
| 9306 | } |
| 9307 | } |
| 9308 | |
| 9309 | return null; |
| 9310 | } |
| 9311 |
no test coverage detected