Don't double invoke getDerivedStateFromProps for module pattern (#21193)

This commit is contained in:
Sebastian Markbåge authored and GitHub committed 2021-04-07 16:20:25 -07:00
1 parent e90c76a651
commit 782f689ca8
4 files changed
+2 -24

No files matched your search

@@ -185,7 +185,6 @@ import {
} from './ReactFiberHydrationContext.new';
import {
adoptClassInstance,
applyDerivedStateFromProps,
constructClassInstance,
mountClassInstance,
resumeMountClassInstance,
@@ -1594,16 +1593,6 @@ function mountIndeterminateComponent(
initializeUpdateQueue(workInProgress);
const getDerivedStateFromProps = Component.getDerivedStateFromProps;
if (typeof getDerivedStateFromProps === 'function') {
applyDerivedStateFromProps(
workInProgress,
Component,
getDerivedStateFromProps,
props,
);
}
adoptClassInstance(workInProgress, value);
mountClassInstance(workInProgress, Component, props, renderLanes);
return finishClassComponent(
@@ -185,7 +185,6 @@ import {
} from './ReactFiberHydrationContext.old';
import {
adoptClassInstance,
applyDerivedStateFromProps,
constructClassInstance,
mountClassInstance,
resumeMountClassInstance,
@@ -1594,16 +1593,6 @@ function mountIndeterminateComponent(
initializeUpdateQueue(workInProgress);
const getDerivedStateFromProps = Component.getDerivedStateFromProps;
if (typeof getDerivedStateFromProps === 'function') {
applyDerivedStateFromProps(
workInProgress,
Component,
getDerivedStateFromProps,
props,
);
}
adoptClassInstance(workInProgress, value);
mountClassInstance(workInProgress, Component, props, renderLanes);
return finishClassComponent(
@@ -162,7 +162,7 @@ if (__DEV__) {
Object.freeze(fakeInternalInstance);
}
export function applyDerivedStateFromProps(
function applyDerivedStateFromProps(
workInProgress: Fiber,
ctor: any,
getDerivedStateFromProps: (props: any, state: any) => any,
@@ -162,7 +162,7 @@ if (__DEV__) {
Object.freeze(fakeInternalInstance);
}
export function applyDerivedStateFromProps(
function applyDerivedStateFromProps(
workInProgress: Fiber,
ctor: any,
getDerivedStateFromProps: (props: any, state: any) => any,