(workInProgress, ctor, newProps, renderExpirationTime)
| 13193 | } |
| 13194 | |
| 13195 | function resumeMountClassInstance(workInProgress, ctor, newProps, renderExpirationTime) { |
| 13196 | var instance = workInProgress.stateNode; |
| 13197 | var oldProps = workInProgress.memoizedProps; |
| 13198 | instance.props = oldProps; |
| 13199 | var oldContext = instance.context; |
| 13200 | var contextType = ctor.contextType; |
| 13201 | var nextContext = emptyContextObject; |
| 13202 | |
| 13203 | if (typeof contextType === 'object' && contextType !== null) { |
| 13204 | nextContext = readContext(contextType); |
| 13205 | } else { |
| 13206 | var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); |
| 13207 | nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext); |
| 13208 | } |
| 13209 | |
| 13210 | var getDerivedStateFromProps = ctor.getDerivedStateFromProps; |
| 13211 | var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; // Note: During these life-cycles, instance.props/instance.state are what |
| 13212 | // ever the previously attempted to render - not the "current". However, |
| 13213 | // during componentDidUpdate we pass the "current" props. |
| 13214 | // In order to support react-lifecycles-compat polyfilled components, |
| 13215 | // Unsafe lifecycles should not be invoked for components using the new APIs. |
| 13216 | |
| 13217 | if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) { |
| 13218 | if (oldProps !== newProps || oldContext !== nextContext) { |
| 13219 | callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext); |
| 13220 | } |
| 13221 | } |
| 13222 | |
| 13223 | resetHasForceUpdateBeforeProcessing(); |
| 13224 | var oldState = workInProgress.memoizedState; |
| 13225 | var newState = instance.state = oldState; |
| 13226 | processUpdateQueue(workInProgress, newProps, instance, renderExpirationTime); |
| 13227 | newState = workInProgress.memoizedState; |
| 13228 | |
| 13229 | if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) { |
| 13230 | // If an update was already in progress, we should schedule an Update |
| 13231 | // effect even though we're bailing out, so that cWU/cDU are called. |
| 13232 | if (typeof instance.componentDidMount === 'function') { |
| 13233 | workInProgress.effectTag |= Update; |
| 13234 | } |
| 13235 | |
| 13236 | return false; |
| 13237 | } |
| 13238 | |
| 13239 | if (typeof getDerivedStateFromProps === 'function') { |
| 13240 | applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); |
| 13241 | newState = workInProgress.memoizedState; |
| 13242 | } |
| 13243 | |
| 13244 | var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext); |
| 13245 | |
| 13246 | if (shouldUpdate) { |
| 13247 | // In order to support react-lifecycles-compat polyfilled components, |
| 13248 | // Unsafe lifecycles should not be invoked for components using the new APIs. |
| 13249 | if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) { |
| 13250 | startPhaseTimer(workInProgress, 'componentWillMount'); |
| 13251 | |
| 13252 | if (typeof instance.componentWillMount === 'function') { |
no test coverage detected