(returnFiber, oldFiber, newChild, expirationTime)
| 9149 | } |
| 9150 | |
| 9151 | function updateSlot(returnFiber, oldFiber, newChild, expirationTime) { |
| 9152 | // Update the fiber if the keys match, otherwise return null. |
| 9153 | |
| 9154 | var key = oldFiber !== null ? oldFiber.key : null; |
| 9155 | |
| 9156 | if (typeof newChild === 'string' || typeof newChild === 'number') { |
| 9157 | // Text nodes don't have keys. If the previous node is implicitly keyed |
| 9158 | // we can continue to replace it without aborting even if it is not a text |
| 9159 | // node. |
| 9160 | if (key !== null) { |
| 9161 | return null; |
| 9162 | } |
| 9163 | return updateTextNode(returnFiber, oldFiber, '' + newChild, expirationTime); |
| 9164 | } |
| 9165 | |
| 9166 | if (typeof newChild === 'object' && newChild !== null) { |
| 9167 | switch (newChild.$$typeof) { |
| 9168 | case REACT_ELEMENT_TYPE: |
| 9169 | { |
| 9170 | if (newChild.key === key) { |
| 9171 | if (newChild.type === REACT_FRAGMENT_TYPE) { |
| 9172 | return updateFragment(returnFiber, oldFiber, newChild.props.children, expirationTime, key); |
| 9173 | } |
| 9174 | return updateElement(returnFiber, oldFiber, newChild, expirationTime); |
| 9175 | } else { |
| 9176 | return null; |
| 9177 | } |
| 9178 | } |
| 9179 | case REACT_PORTAL_TYPE: |
| 9180 | { |
| 9181 | if (newChild.key === key) { |
| 9182 | return updatePortal(returnFiber, oldFiber, newChild, expirationTime); |
| 9183 | } else { |
| 9184 | return null; |
| 9185 | } |
| 9186 | } |
| 9187 | } |
| 9188 | |
| 9189 | if (isArray$1(newChild) || getIteratorFn(newChild)) { |
| 9190 | if (key !== null) { |
| 9191 | return null; |
| 9192 | } |
| 9193 | |
| 9194 | return updateFragment(returnFiber, oldFiber, newChild, expirationTime, null); |
| 9195 | } |
| 9196 | |
| 9197 | throwOnInvalidObjectType(returnFiber, newChild); |
| 9198 | } |
| 9199 | |
| 9200 | { |
| 9201 | if (typeof newChild === 'function') { |
| 9202 | warnOnFunctionType(); |
| 9203 | } |
| 9204 | } |
| 9205 | |
| 9206 | return null; |
| 9207 | } |
| 9208 |
no test coverage detected