in Libraries/Renderer/implementations/ReactFabric-profiling.js [4408:4609]
function updateClassComponent(
current,
workInProgress,
Component,
nextProps,
renderLanes
) {
if (isContextProvider(Component)) {
var hasContext = !0;
pushContextProvider(workInProgress);
} else hasContext = !1;
prepareToReadContext(workInProgress, renderLanes);
if (null === workInProgress.stateNode)
null !== current &&
((current.alternate = null),
(workInProgress.alternate = null),
(workInProgress.flags |= 2)),
constructClassInstance(workInProgress, Component, nextProps),
mountClassInstance(workInProgress, Component, nextProps, renderLanes),
(nextProps = !0);
else if (null === current) {
var instance = workInProgress.stateNode,
oldProps = workInProgress.memoizedProps;
instance.props = oldProps;
var oldContext = instance.context,
contextType = Component.contextType;
"object" === typeof contextType && null !== contextType
? (contextType = readContext(contextType))
: ((contextType = isContextProvider(Component)
? previousContext
: contextStackCursor.current),
(contextType = getMaskedContext(workInProgress, contextType)));
var getDerivedStateFromProps = Component.getDerivedStateFromProps,
hasNewLifecycles =
"function" === typeof getDerivedStateFromProps ||
"function" === typeof instance.getSnapshotBeforeUpdate;
hasNewLifecycles ||
("function" !== typeof instance.UNSAFE_componentWillReceiveProps &&
"function" !== typeof instance.componentWillReceiveProps) ||
((oldProps !== nextProps || oldContext !== contextType) &&
callComponentWillReceiveProps(
workInProgress,
instance,
nextProps,
contextType
));
hasForceUpdate = !1;
var oldState = workInProgress.memoizedState;
instance.state = oldState;
processUpdateQueue(workInProgress, nextProps, instance, renderLanes);
oldContext = workInProgress.memoizedState;
oldProps !== nextProps ||
oldState !== oldContext ||
didPerformWorkStackCursor.current ||
hasForceUpdate
? ("function" === typeof getDerivedStateFromProps &&
(applyDerivedStateFromProps(
workInProgress,
Component,
getDerivedStateFromProps,
nextProps
),
(oldContext = workInProgress.memoizedState)),
(oldProps =
hasForceUpdate ||
checkShouldComponentUpdate(
workInProgress,
Component,
oldProps,
nextProps,
oldState,
oldContext,
contextType
))
? (hasNewLifecycles ||
("function" !== typeof instance.UNSAFE_componentWillMount &&
"function" !== typeof instance.componentWillMount) ||
("function" === typeof instance.componentWillMount &&
instance.componentWillMount(),
"function" === typeof instance.UNSAFE_componentWillMount &&
instance.UNSAFE_componentWillMount()),
"function" === typeof instance.componentDidMount &&
(workInProgress.flags |= 4))
: ("function" === typeof instance.componentDidMount &&
(workInProgress.flags |= 4),
(workInProgress.memoizedProps = nextProps),
(workInProgress.memoizedState = oldContext)),
(instance.props = nextProps),
(instance.state = oldContext),
(instance.context = contextType),
(nextProps = oldProps))
: ("function" === typeof instance.componentDidMount &&
(workInProgress.flags |= 4),
(nextProps = !1));
} else {
instance = workInProgress.stateNode;
cloneUpdateQueue(current, workInProgress);
oldProps = workInProgress.memoizedProps;
contextType =
workInProgress.type === workInProgress.elementType
? oldProps
: resolveDefaultProps(workInProgress.type, oldProps);
instance.props = contextType;
hasNewLifecycles = workInProgress.pendingProps;
oldState = instance.context;
oldContext = Component.contextType;
"object" === typeof oldContext && null !== oldContext
? (oldContext = readContext(oldContext))
: ((oldContext = isContextProvider(Component)
? previousContext
: contextStackCursor.current),
(oldContext = getMaskedContext(workInProgress, oldContext)));
var getDerivedStateFromProps$jscomp$0 = Component.getDerivedStateFromProps;
(getDerivedStateFromProps =
"function" === typeof getDerivedStateFromProps$jscomp$0 ||
"function" === typeof instance.getSnapshotBeforeUpdate) ||
("function" !== typeof instance.UNSAFE_componentWillReceiveProps &&
"function" !== typeof instance.componentWillReceiveProps) ||
((oldProps !== hasNewLifecycles || oldState !== oldContext) &&
callComponentWillReceiveProps(
workInProgress,
instance,
nextProps,
oldContext
));
hasForceUpdate = !1;
oldState = workInProgress.memoizedState;
instance.state = oldState;
processUpdateQueue(workInProgress, nextProps, instance, renderLanes);
var newState = workInProgress.memoizedState;
oldProps !== hasNewLifecycles ||
oldState !== newState ||
didPerformWorkStackCursor.current ||
hasForceUpdate
? ("function" === typeof getDerivedStateFromProps$jscomp$0 &&
(applyDerivedStateFromProps(
workInProgress,
Component,
getDerivedStateFromProps$jscomp$0,
nextProps
),
(newState = workInProgress.memoizedState)),
(contextType =
hasForceUpdate ||
checkShouldComponentUpdate(
workInProgress,
Component,
contextType,
nextProps,
oldState,
newState,
oldContext
) ||
!1)
? (getDerivedStateFromProps ||
("function" !== typeof instance.UNSAFE_componentWillUpdate &&
"function" !== typeof instance.componentWillUpdate) ||
("function" === typeof instance.componentWillUpdate &&
instance.componentWillUpdate(nextProps, newState, oldContext),
"function" === typeof instance.UNSAFE_componentWillUpdate &&
instance.UNSAFE_componentWillUpdate(
nextProps,
newState,
oldContext
)),
"function" === typeof instance.componentDidUpdate &&
(workInProgress.flags |= 4),
"function" === typeof instance.getSnapshotBeforeUpdate &&
(workInProgress.flags |= 512))
: ("function" !== typeof instance.componentDidUpdate ||
(oldProps === current.memoizedProps &&
oldState === current.memoizedState) ||
(workInProgress.flags |= 4),
"function" !== typeof instance.getSnapshotBeforeUpdate ||
(oldProps === current.memoizedProps &&
oldState === current.memoizedState) ||
(workInProgress.flags |= 512),
(workInProgress.memoizedProps = nextProps),
(workInProgress.memoizedState = newState)),
(instance.props = nextProps),
(instance.state = newState),
(instance.context = oldContext),
(nextProps = contextType))
: ("function" !== typeof instance.componentDidUpdate ||
(oldProps === current.memoizedProps &&
oldState === current.memoizedState) ||
(workInProgress.flags |= 4),
"function" !== typeof instance.getSnapshotBeforeUpdate ||
(oldProps === current.memoizedProps &&
oldState === current.memoizedState) ||
(workInProgress.flags |= 512),
(nextProps = !1));
}
return finishClassComponent(
current,
workInProgress,
Component,
nextProps,
hasContext,
renderLanes
);
}