(returnFiber, oldFiber, newChild, expirationTime)
| 9207 | } |
| 9208 | |
| 9209 | function updateSlot(returnFiber, oldFiber, newChild, expirationTime) { |
| 9210 | // Update the fiber if the keys match, otherwise return null. |
| 9211 | |
| 9212 | var key = oldFiber !== null ? oldFiber.key : null; |
| 9213 | |
| 9214 | if (typeof newChild === 'string' || typeof newChild === 'number') { |
| 9215 | // Text nodes don't have keys. If the previous node is implicitly keyed |
| 9216 | // we can continue to replace it without aborting even if it is not a text |
| 9217 | // node. |
| 9218 | if (key !== null) { |
| 9219 | return null; |
| 9220 | } |
| 9221 | return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime); |
| 9222 | } |
| 9223 | |
| 9224 | if (typeof newChild === 'object' && newChild !== null) { |
| 9225 | switch (newChild.$$typeof) { |
| 9226 | case REACT_ELEMENT_TYPE: |
| 9227 | { |
| 9228 | if (newChild.key === key) { |
| 9229 | if (newChild.type === REACT_FRAGMENT_TYPE) { |
| 9230 | return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key); |
| 9231 | } |
| 9232 | return updateElement(returnFiber, oldFiber, newChild, expirationTime); |
| 9233 | } else { |
| 9234 | return null; |
| 9235 | } |
| 9236 | } |
| 9237 | case REACT_PORTAL_TYPE: |
| 9238 | { |
| 9239 | if (newChild.key === key) { |
| 9240 | return updatePortal(returnFiber, oldFiber, newChild, expirationTime); |
| 9241 | } else { |
| 9242 | return null; |
| 9243 | } |
| 9244 | } |
| 9245 | } |
| 9246 | |
| 9247 | if (isArray$1(newChild) || getIteratorFn(newChild)) { |
| 9248 | if (key !== null) { |
| 9249 | return null; |
| 9250 | } |
| 9251 | |
| 9252 | return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null); |
| 9253 | } |
| 9254 | |
| 9255 | throwOnInvalidObjectType(returnFiber, newChild); |
| 9256 | } |
| 9257 | |
| 9258 | { |
| 9259 | if (typeof newChild === 'function') { |
| 9260 | warnOnFunctionType(); |
| 9261 | } |
| 9262 | } |
| 9263 | |
| 9264 | return null; |
| 9265 | } |
| 9266 |
no test coverage detected