(workInProgress, ctor, newProps, renderLanes)
| 18401 | } |
| 18402 | |
| 18403 | function resumeMountClassInstance(workInProgress, ctor, newProps, renderLanes) { |
| 18404 | var instance = workInProgress.stateNode; |
| 18405 | var oldProps = workInProgress.memoizedProps; |
| 18406 | instance.props = oldProps; |
| 18407 | var oldContext = instance.context; |
| 18408 | var contextType = ctor.contextType; |
| 18409 | var nextContext = emptyContextObject; |
| 18410 | |
| 18411 | if (typeof contextType === 'object' && contextType !== null) { |
| 18412 | nextContext = readContext(contextType); |
| 18413 | } else { |
| 18414 | var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); |
| 18415 | nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext); |
| 18416 | } |
| 18417 | |
| 18418 | var getDerivedStateFromProps = ctor.getDerivedStateFromProps; |
| 18419 | var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; // Note: During these life-cycles, instance.props/instance.state are what |
| 18420 | // ever the previously attempted to render - not the "current". However, |
| 18421 | // during componentDidUpdate we pass the "current" props. |
| 18422 | // In order to support react-lifecycles-compat polyfilled components, |
| 18423 | // Unsafe lifecycles should not be invoked for components using the new APIs. |
| 18424 | |
| 18425 | if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) { |
| 18426 | if (oldProps !== newProps || oldContext !== nextContext) { |
| 18427 | callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext); |
| 18428 | } |
| 18429 | } |
| 18430 | |
| 18431 | resetHasForceUpdateBeforeProcessing(); |
| 18432 | var oldState = workInProgress.memoizedState; |
| 18433 | var newState = instance.state = oldState; |
| 18434 | processUpdateQueue(workInProgress, newProps, instance, renderLanes); |
| 18435 | newState = workInProgress.memoizedState; |
| 18436 | |
| 18437 | if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) { |
| 18438 | // If an update was already in progress, we should schedule an Update |
| 18439 | // effect even though we're bailing out, so that cWU/cDU are called. |
| 18440 | if (typeof instance.componentDidMount === 'function') { |
| 18441 | var fiberFlags = Update; |
| 18442 | |
| 18443 | { |
| 18444 | fiberFlags |= LayoutStatic; |
| 18445 | } |
| 18446 | |
| 18447 | if ( (workInProgress.mode & StrictEffectsMode) !== NoMode) { |
| 18448 | fiberFlags |= MountLayoutDev; |
| 18449 | } |
| 18450 | |
| 18451 | workInProgress.flags |= fiberFlags; |
| 18452 | } |
| 18453 | |
| 18454 | return false; |
| 18455 | } |
| 18456 | |
| 18457 | if (typeof getDerivedStateFromProps === 'function') { |
| 18458 | applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); |
| 18459 | newState = workInProgress.memoizedState; |
| 18460 | } |
no test coverage detected
searching dependent graphs…