@samitouri / QOS-React / commits / 782f689ca8

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

Sebastian Markbåge committed Apr 7, 2021 at 19:20 UTC 782f689ca8380a715ab0c24e326fc293e5d25647
4 files changed +2 -24
packages/react-reconciler/src/ReactFiberBeginWork.new.js
-11
@@ -185,7 +185,6 @@ import {
185 } from './ReactFiberHydrationContext.new';
186 import {
187 adoptClassInstance,
188 - applyDerivedStateFromProps,
188 constructClassInstance,
189 mountClassInstance,
190 resumeMountClassInstance,
@@ -1594,16 +1593,6 @@ function mountIndeterminateComponent(
1593
1594 initializeUpdateQueue(workInProgress);
1595
1597 - const getDerivedStateFromProps = Component.getDerivedStateFromProps;
1598 - if (typeof getDerivedStateFromProps === 'function') {
1599 - applyDerivedStateFromProps(
1600 - workInProgress,
1601 - Component,
1602 - getDerivedStateFromProps,
1603 - props,
1604 - );
1605 - }
1606 -
1596 adoptClassInstance(workInProgress, value);
1597 mountClassInstance(workInProgress, Component, props, renderLanes);
1598 return finishClassComponent(
packages/react-reconciler/src/ReactFiberBeginWork.old.js
-11
@@ -185,7 +185,6 @@ import {
185 } from './ReactFiberHydrationContext.old';
186 import {
187 adoptClassInstance,
188 - applyDerivedStateFromProps,
188 constructClassInstance,
189 mountClassInstance,
190 resumeMountClassInstance,
@@ -1594,16 +1593,6 @@ function mountIndeterminateComponent(
1593
1594 initializeUpdateQueue(workInProgress);
1595
1597 - const getDerivedStateFromProps = Component.getDerivedStateFromProps;
1598 - if (typeof getDerivedStateFromProps === 'function') {
1599 - applyDerivedStateFromProps(
1600 - workInProgress,
1601 - Component,
1602 - getDerivedStateFromProps,
1603 - props,
1604 - );
1605 - }
1606 -
1596 adoptClassInstance(workInProgress, value);
1597 mountClassInstance(workInProgress, Component, props, renderLanes);
1598 return finishClassComponent(
packages/react-reconciler/src/ReactFiberClassComponent.new.js
+1 -1
@@ -162,7 +162,7 @@ if (__DEV__) {
162 Object.freeze(fakeInternalInstance);
163 }
164
165 -export function applyDerivedStateFromProps(
165 +function applyDerivedStateFromProps(
166 workInProgress: Fiber,
167 ctor: any,
168 getDerivedStateFromProps: (props: any, state: any) => any,
packages/react-reconciler/src/ReactFiberClassComponent.old.js
+1 -1
@@ -162,7 +162,7 @@ if (__DEV__) {
162 Object.freeze(fakeInternalInstance);
163 }
164
165 -export function applyDerivedStateFromProps(
165 +function applyDerivedStateFromProps(
166 workInProgress: Fiber,
167 ctor: any,
168 getDerivedStateFromProps: (props: any, state: any) => any,