(workInProgress, renderExpirationTime)
| 8591 | } |
| 8592 | |
| 8593 | function resumeMountClassInstance(workInProgress, renderExpirationTime) { |
| 8594 | var ctor = workInProgress.type; |
| 8595 | var instance = workInProgress.stateNode; |
| 8596 | resetInputPointers(workInProgress, instance); |
| 8597 | |
| 8598 | var oldProps = workInProgress.memoizedProps; |
| 8599 | var newProps = workInProgress.pendingProps; |
| 8600 | var oldContext = instance.context; |
| 8601 | var newUnmaskedContext = getUnmaskedContext(workInProgress); |
| 8602 | var newContext = getMaskedContext(workInProgress, newUnmaskedContext); |
| 8603 | |
| 8604 | // Note: During these life-cycles, instance.props/instance.state are what |
| 8605 | // ever the previously attempted to render - not the "current". However, |
| 8606 | // during componentDidUpdate we pass the "current" props. |
| 8607 | |
| 8608 | // In order to support react-lifecycles-compat polyfilled components, |
| 8609 | // Unsafe lifecycles should not be invoked for any component with the new gDSFP. |
| 8610 | if ((typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function') && typeof ctor.getDerivedStateFromProps !== 'function') { |
| 8611 | if (oldProps !== newProps || oldContext !== newContext) { |
| 8612 | callComponentWillReceiveProps(workInProgress, instance, newProps, newContext); |
| 8613 | } |
| 8614 | } |
| 8615 | |
| 8616 | // Compute the next state using the memoized state and the update queue. |
| 8617 | var oldState = workInProgress.memoizedState; |
| 8618 | // TODO: Previous state can be null. |
| 8619 | var newState = void 0; |
| 8620 | var derivedStateFromCatch = void 0; |
| 8621 | if (workInProgress.updateQueue !== null) { |
| 8622 | newState = processUpdateQueue(null, workInProgress, workInProgress.updateQueue, instance, newProps, renderExpirationTime); |
| 8623 | |
| 8624 | var updateQueue = workInProgress.updateQueue; |
| 8625 | if (updateQueue !== null && updateQueue.capturedValues !== null && enableGetDerivedStateFromCatch && typeof ctor.getDerivedStateFromCatch === 'function') { |
| 8626 | var capturedValues = updateQueue.capturedValues; |
| 8627 | // Don't remove these from the update queue yet. We need them in |
| 8628 | // finishClassComponent. Do the reset there. |
| 8629 | // TODO: This is awkward. Refactor class components. |
| 8630 | // updateQueue.capturedValues = null; |
| 8631 | derivedStateFromCatch = callGetDerivedStateFromCatch(ctor, capturedValues); |
| 8632 | } |
| 8633 | } else { |
| 8634 | newState = oldState; |
| 8635 | } |
| 8636 | |
| 8637 | var derivedStateFromProps = void 0; |
| 8638 | if (oldProps !== newProps) { |
| 8639 | // The prevState parameter should be the partially updated state. |
| 8640 | // Otherwise, spreading state in return values could override updates. |
| 8641 | derivedStateFromProps = callGetDerivedStateFromProps(workInProgress, instance, newProps, newState); |
| 8642 | } |
| 8643 | |
| 8644 | if (derivedStateFromProps !== null && derivedStateFromProps !== undefined) { |
| 8645 | // Render-phase updates (like this) should not be added to the update queue, |
| 8646 | // So that multiple render passes do not enqueue multiple updates. |
| 8647 | // Instead, just synchronously merge the returned state into the instance. |
| 8648 | newState = newState === null || newState === undefined ? derivedStateFromProps : _assign({}, newState, derivedStateFromProps); |
| 8649 | } |
| 8650 | if (derivedStateFromCatch !== null && derivedStateFromCatch !== undefined) { |
no test coverage detected