(workInProgress, renderExpirationTime)
| 8694 | } |
| 8695 | |
| 8696 | function resumeMountClassInstance(workInProgress, renderExpirationTime) { |
| 8697 | var ctor = workInProgress.type; |
| 8698 | var instance = workInProgress.stateNode; |
| 8699 | resetInputPointers(workInProgress, instance); |
| 8700 | |
| 8701 | var oldProps = workInProgress.memoizedProps; |
| 8702 | var newProps = workInProgress.pendingProps; |
| 8703 | var oldContext = instance.context; |
| 8704 | var newUnmaskedContext = getUnmaskedContext(workInProgress); |
| 8705 | var newContext = getMaskedContext(workInProgress, newUnmaskedContext); |
| 8706 | |
| 8707 | // Note: During these life-cycles, instance.props/instance.state are what |
| 8708 | // ever the previously attempted to render - not the "current". However, |
| 8709 | // during componentDidUpdate we pass the "current" props. |
| 8710 | |
| 8711 | // In order to support react-lifecycles-compat polyfilled components, |
| 8712 | // Unsafe lifecycles should not be invoked for any component with the new gDSFP. |
| 8713 | if ((typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function') && typeof ctor.getDerivedStateFromProps !== 'function') { |
| 8714 | if (oldProps !== newProps || oldContext !== newContext) { |
| 8715 | callComponentWillReceiveProps(workInProgress, instance, newProps, newContext); |
| 8716 | } |
| 8717 | } |
| 8718 | |
| 8719 | // Compute the next state using the memoized state and the update queue. |
| 8720 | var oldState = workInProgress.memoizedState; |
| 8721 | // TODO: Previous state can be null. |
| 8722 | var newState = void 0; |
| 8723 | var derivedStateFromCatch = void 0; |
| 8724 | if (workInProgress.updateQueue !== null) { |
| 8725 | newState = processUpdateQueue(null, workInProgress, workInProgress.updateQueue, instance, newProps, renderExpirationTime); |
| 8726 | |
| 8727 | var updateQueue = workInProgress.updateQueue; |
| 8728 | if (updateQueue !== null && updateQueue.capturedValues !== null && enableGetDerivedStateFromCatch && typeof ctor.getDerivedStateFromCatch === 'function') { |
| 8729 | var capturedValues = updateQueue.capturedValues; |
| 8730 | // Don't remove these from the update queue yet. We need them in |
| 8731 | // finishClassComponent. Do the reset there. |
| 8732 | // TODO: This is awkward. Refactor class components. |
| 8733 | // updateQueue.capturedValues = null; |
| 8734 | derivedStateFromCatch = callGetDerivedStateFromCatch(ctor, capturedValues); |
| 8735 | } |
| 8736 | } else { |
| 8737 | newState = oldState; |
| 8738 | } |
| 8739 | |
| 8740 | var derivedStateFromProps = void 0; |
| 8741 | if (oldProps !== newProps) { |
| 8742 | // The prevState parameter should be the partially updated state. |
| 8743 | // Otherwise, spreading state in return values could override updates. |
| 8744 | derivedStateFromProps = callGetDerivedStateFromProps(workInProgress, instance, newProps, newState); |
| 8745 | } |
| 8746 | |
| 8747 | if (derivedStateFromProps !== null && derivedStateFromProps !== undefined) { |
| 8748 | // Render-phase updates (like this) should not be added to the update queue, |
| 8749 | // So that multiple render passes do not enqueue multiple updates. |
| 8750 | // Instead, just synchronously merge the returned state into the instance. |
| 8751 | newState = newState === null || newState === undefined ? derivedStateFromProps : _assign({}, newState, derivedStateFromProps); |
| 8752 | } |
| 8753 | if (derivedStateFromCatch !== null && derivedStateFromCatch !== undefined) { |
no test coverage detected