Skip to content

Commit 607e68f

Browse files
committed
Remove redundant work during mounting Indeterminate Component
During mounting Indeterminate Component, it's redundant to check and call getDerivedStateFromProps method. Because getDerivedStateFromProps method will be called by mountClassInstance right after changing the fiber's tag to Class Component.
1 parent 7d1169b commit 607e68f

File tree

1 file changed

+0
-11
lines changed

1 file changed

+0
-11
lines changed

packages/react-reconciler/src/ReactFiberBeginWork.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ import warningWithoutStack from 'shared/warningWithoutStack';
5757
import * as ReactCurrentFiber from './ReactCurrentFiber';
5858
import {cancelWorkTimer} from './ReactDebugFiberPerf';
5959

60-
import {applyDerivedStateFromProps} from './ReactFiberClassComponent';
6160
import {
6261
mountChildFibers,
6362
reconcileChildFibers,
@@ -735,16 +734,6 @@ function mountIndeterminateComponent(
735734
workInProgress.memoizedState =
736735
value.state !== null && value.state !== undefined ? value.state : null;
737736

738-
const getDerivedStateFromProps = Component.getDerivedStateFromProps;
739-
if (typeof getDerivedStateFromProps === 'function') {
740-
applyDerivedStateFromProps(
741-
workInProgress,
742-
Component,
743-
getDerivedStateFromProps,
744-
props,
745-
);
746-
}
747-
748737
adoptClassInstance(workInProgress, value);
749738
mountClassInstance(workInProgress, Component, props, renderExpirationTime);
750739
return finishClassComponent(

0 commit comments

Comments
 (0)