(workInProgress, renderExpirationTime)
| 8807 | } |
| 8808 | |
| 8809 | function resumeMountClassInstance(workInProgress, renderExpirationTime) { |
| 8810 | var ctor = workInProgress.type; |
| 8811 | var instance = workInProgress.stateNode; |
| 8812 | resetInputPointers(workInProgress, instance); |
| 8813 | |
| 8814 | var oldProps = workInProgress.memoizedProps; |
| 8815 | var newProps = workInProgress.pendingProps; |
| 8816 | var oldContext = instance.context; |
| 8817 | var newUnmaskedContext = getUnmaskedContext(workInProgress); |
| 8818 | var newContext = getMaskedContext(workInProgress, newUnmaskedContext); |
| 8819 | |
| 8820 | // Note: During these life-cycles, instance.props/instance.state are what |
| 8821 | // ever the previously attempted to render - not the "current". However, |
| 8822 | // during componentDidUpdate we pass the "current" props. |
| 8823 | |
| 8824 | // In order to support react-lifecycles-compat polyfilled components, |
| 8825 | // Unsafe lifecycles should not be invoked for any component with the new gDSFP. |
| 8826 | if ((typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function') && typeof ctor.getDerivedStateFromProps !== 'function') { |
| 8827 | if (oldProps !== newProps || oldContext !== newContext) { |
| 8828 | callComponentWillReceiveProps(workInProgress, instance, newProps, newContext); |
| 8829 | } |
| 8830 | } |
| 8831 | |
| 8832 | // Compute the next state using the memoized state and the update queue. |
| 8833 | var oldState = workInProgress.memoizedState; |
| 8834 | // TODO: Previous state can be null. |
| 8835 | var newState = void 0; |
| 8836 | var derivedStateFromCatch = void 0; |
| 8837 | if (workInProgress.updateQueue !== null) { |
| 8838 | newState = processUpdateQueue(null, workInProgress, workInProgress.updateQueue, instance, newProps, renderExpirationTime); |
| 8839 | |
| 8840 | var updateQueue = workInProgress.updateQueue; |
| 8841 | if (updateQueue !== null && updateQueue.capturedValues !== null && enableGetDerivedStateFromCatch && typeof ctor.getDerivedStateFromCatch === 'function') { |
| 8842 | var capturedValues = updateQueue.capturedValues; |
| 8843 | // Don't remove these from the update queue yet. We need them in |
| 8844 | // finishClassComponent. Do the reset there. |
| 8845 | // TODO: This is awkward. Refactor class components. |
| 8846 | // updateQueue.capturedValues = null; |
| 8847 | derivedStateFromCatch = callGetDerivedStateFromCatch(ctor, capturedValues); |
| 8848 | } |
| 8849 | } else { |
| 8850 | newState = oldState; |
| 8851 | } |
| 8852 | |
| 8853 | var derivedStateFromProps = void 0; |
| 8854 | if (oldProps !== newProps) { |
| 8855 | // The prevState parameter should be the partially updated state. |
| 8856 | // Otherwise, spreading state in return values could override updates. |
| 8857 | derivedStateFromProps = callGetDerivedStateFromProps(workInProgress, instance, newProps, newState); |
| 8858 | } |
| 8859 | |
| 8860 | if (derivedStateFromProps !== null && derivedStateFromProps !== undefined) { |
| 8861 | // Render-phase updates (like this) should not be added to the update queue, |
| 8862 | // So that multiple render passes do not enqueue multiple updates. |
| 8863 | // Instead, just synchronously merge the returned state into the instance. |
| 8864 | newState = newState === null || newState === undefined ? derivedStateFromProps : _assign({}, newState, derivedStateFromProps); |
| 8865 | } |
| 8866 | if (derivedStateFromCatch !== null && derivedStateFromCatch !== undefined) { |
no test coverage detected