mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Don't double invoke getDerivedStateFromProps for module pattern (#21193)
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user