Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions packages/react-reconciler/src/ReactFiberBeginWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -2033,7 +2033,7 @@ function mountLazyComponent(

if (typeof Component === 'function') {
if (isFunctionClassComponent(Component)) {
const resolvedProps = resolveClassComponentProps(Component, props, false);
const resolvedProps = resolveClassComponentProps(Component, props);
workInProgress.tag = ClassComponent;
if (__DEV__) {
workInProgress.type = Component =
Expand Down Expand Up @@ -4134,7 +4134,6 @@ function beginWork(
const resolvedProps = resolveClassComponentProps(
Component,
unresolvedProps,
workInProgress.elementType === Component,
);
return updateClassComponent(
current,
Expand Down Expand Up @@ -4210,7 +4209,6 @@ function beginWork(
const resolvedProps = resolveClassComponentProps(
Component,
unresolvedProps,
workInProgress.elementType === Component,
);
return mountIncompleteClassComponent(
current,
Expand All @@ -4229,7 +4227,6 @@ function beginWork(
const resolvedProps = resolveClassComponentProps(
Component,
unresolvedProps,
workInProgress.elementType === Component,
);
return mountIncompleteFunctionComponent(
current,
Expand Down
18 changes: 2 additions & 16 deletions packages/react-reconciler/src/ReactFiberClassComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -858,11 +858,7 @@ function resumeMountClassInstance(
const instance = workInProgress.stateNode;

const unresolvedOldProps = workInProgress.memoizedProps;
const oldProps = resolveClassComponentProps(
ctor,
unresolvedOldProps,
workInProgress.type === workInProgress.elementType,
);
const oldProps = resolveClassComponentProps(ctor, unresolvedOldProps);
instance.props = oldProps;

const oldContext = instance.context;
Expand Down Expand Up @@ -1017,11 +1013,7 @@ function updateClassInstance(
cloneUpdateQueue(current, workInProgress);

const unresolvedOldProps = workInProgress.memoizedProps;
const oldProps = resolveClassComponentProps(
ctor,
unresolvedOldProps,
workInProgress.type === workInProgress.elementType,
);
const oldProps = resolveClassComponentProps(ctor, unresolvedOldProps);
instance.props = oldProps;
const unresolvedNewProps = workInProgress.pendingProps;

Expand Down Expand Up @@ -1192,12 +1184,6 @@ function updateClassInstance(
export function resolveClassComponentProps(
Component: any,
baseProps: Object,
// Only resolve default props if this is a lazy component. Otherwise, they
// would have already been resolved by the JSX runtime.
// TODO: We're going to remove default prop resolution from the JSX runtime
// and keep it only for class components. As part of that change, we should
// remove this extra check.
alreadyResolvedDefaultProps: boolean,
): Object {
let newProps = baseProps;

Expand Down
3 changes: 0 additions & 3 deletions packages/react-reconciler/src/ReactFiberCommitEffects.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,6 @@ export function commitClassLayoutLifecycles(
const prevProps = resolveClassComponentProps(
finishedWork.type,
current.memoizedProps,
finishedWork.elementType === finishedWork.type,
);
const prevState = current.memoizedState;
// We could update instance props and state here,
Expand Down Expand Up @@ -671,7 +670,6 @@ export function commitClassSnapshot(finishedWork: Fiber, current: Fiber) {
const resolvedPrevProps = resolveClassComponentProps(
finishedWork.type,
prevProps,
finishedWork.elementType === finishedWork.type,
);
let snapshot;
if (__DEV__) {
Expand Down Expand Up @@ -716,7 +714,6 @@ export function safelyCallComponentWillUnmount(
instance.props = resolveClassComponentProps(
current.type,
current.memoizedProps,
current.elementType === current.type,
);
instance.state = current.memoizedState;
if (shouldProfile(current)) {
Expand Down
Loading