(workInProgress, renderExpirationTime)
| 7917 | } |
| 7918 | |
| 7919 | function resumeMountClassInstance(workInProgress, renderExpirationTime) { |
| 7920 | var ctor = workInProgress.type; |
| 7921 | var instance = workInProgress.stateNode; |
| 7922 | resetInputPointers(workInProgress, instance); |
| 7923 | |
| 7924 | var oldProps = workInProgress.memoizedProps; |
| 7925 | var newProps = workInProgress.pendingProps; |
| 7926 | var oldContext = instance.context; |
| 7927 | var newUnmaskedContext = getUnmaskedContext(workInProgress); |
| 7928 | var newContext = getMaskedContext(workInProgress, newUnmaskedContext); |
| 7929 | |
| 7930 | // Note: During these life-cycles, instance.props/instance.state are what |
| 7931 | // ever the previously attempted to render - not the "current". However, |
| 7932 | // during componentDidUpdate we pass the "current" props. |
| 7933 | |
| 7934 | // In order to support react-lifecycles-compat polyfilled components, |
| 7935 | // Unsafe lifecycles should not be invoked for any component with the new gDSFP. |
| 7936 | if ((typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function') && typeof ctor.getDerivedStateFromProps !== 'function') { |
| 7937 | if (oldProps !== newProps || oldContext !== newContext) { |
| 7938 | callComponentWillReceiveProps(workInProgress, instance, newProps, newContext); |
| 7939 | } |
| 7940 | } |
| 7941 | |
| 7942 | // Compute the next state using the memoized state and the update queue. |
| 7943 | var oldState = workInProgress.memoizedState; |
| 7944 | // TODO: Previous state can be null. |
| 7945 | var newState = void 0; |
| 7946 | var derivedStateFromCatch = void 0; |
| 7947 | if (workInProgress.updateQueue !== null) { |
| 7948 | newState = processUpdateQueue(null, workInProgress, workInProgress.updateQueue, instance, newProps, renderExpirationTime); |
| 7949 | |
| 7950 | var updateQueue = workInProgress.updateQueue; |
| 7951 | if (updateQueue !== null && updateQueue.capturedValues !== null && enableGetDerivedStateFromCatch && typeof ctor.getDerivedStateFromCatch === 'function') { |
| 7952 | var capturedValues = updateQueue.capturedValues; |
| 7953 | // Don't remove these from the update queue yet. We need them in |
| 7954 | // finishClassComponent. Do the reset there. |
| 7955 | // TODO: This is awkward. Refactor class components. |
| 7956 | // updateQueue.capturedValues = null; |
| 7957 | derivedStateFromCatch = callGetDerivedStateFromCatch(ctor, capturedValues); |
| 7958 | } |
| 7959 | } else { |
| 7960 | newState = oldState; |
| 7961 | } |
| 7962 | |
| 7963 | var derivedStateFromProps = void 0; |
| 7964 | if (oldProps !== newProps) { |
| 7965 | // The prevState parameter should be the partially updated state. |
| 7966 | // Otherwise, spreading state in return values could override updates. |
| 7967 | derivedStateFromProps = callGetDerivedStateFromProps(workInProgress, instance, newProps, newState); |
| 7968 | } |
| 7969 | |
| 7970 | if (derivedStateFromProps !== null && derivedStateFromProps !== undefined) { |
| 7971 | // Render-phase updates (like this) should not be added to the update queue, |
| 7972 | // So that multiple render passes do not enqueue multiple updates. |
| 7973 | // Instead, just synchronously merge the returned state into the instance. |
| 7974 | newState = newState === null || newState === undefined ? derivedStateFromProps : _assign({}, newState, derivedStateFromProps); |
| 7975 | } |
| 7976 | if (derivedStateFromCatch !== null && derivedStateFromCatch !== undefined) { |
no test coverage detected