Skip to content

Commit 9f9e660

Browse files
committed
Remove module pattern function component support (flag only) (#28671)
Remove module pattern function component support (flag only) > This is a redo of #27742, but only including the flag removal, excluding further simplifications. The module pattern ``` function MyComponent() { return { render() { return this.state.foo } } } ``` has been deprecated for approximately 5 years now. This PR removes support for this pattern. DiffTrain build for [a73c345](a73c345)
1 parent 87edb8c commit 9f9e660

20 files changed

+302
-345
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f2690747239533fa266612d2d4dd9ae88ea92fbc
1+
a73c3450e1b528fa6cb3e94fa4d4359c7a4b61f1

compiled/facebook-www/ReactART-dev.classic.js

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if (__DEV__) {
6666
return self;
6767
}
6868

69-
var ReactVersion = "19.0.0-www-classic-3513bb8c";
69+
var ReactVersion = "19.0.0-www-classic-b7bec335";
7070

7171
var LegacyRoot = 0;
7272
var ConcurrentRoot = 1;
@@ -16812,20 +16812,17 @@ if (__DEV__) {
1681216812
didWarnAboutModulePatternComponent[_componentName] = true;
1681316813
}
1681416814
}
16815-
}
16816-
16817-
{
16818-
// Proceed under the assumption that this is a function component
16819-
workInProgress.tag = FunctionComponent;
16815+
} // Proceed under the assumption that this is a function component
1682016816

16821-
reconcileChildren(null, workInProgress, value, renderLanes);
16817+
workInProgress.tag = FunctionComponent;
1682216818

16823-
{
16824-
validateFunctionComponentInDev(workInProgress, Component);
16825-
}
16819+
reconcileChildren(null, workInProgress, value, renderLanes);
1682616820

16827-
return workInProgress.child;
16821+
{
16822+
validateFunctionComponentInDev(workInProgress, Component);
1682816823
}
16824+
16825+
return workInProgress.child;
1682916826
}
1683016827

1683116828
function validateFunctionComponentInDev(workInProgress, Component) {
@@ -16864,33 +16861,33 @@ if (__DEV__) {
1686416861
}
1686516862

1686616863
if (Component.defaultProps !== undefined) {
16867-
var _componentName3 =
16864+
var _componentName2 =
1686816865
getComponentNameFromType(Component) || "Unknown";
1686916866

16870-
if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName3]) {
16867+
if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName2]) {
1687116868
error(
1687216869
"%s: Support for defaultProps will be removed from function components " +
1687316870
"in a future major release. Use JavaScript default parameters instead.",
16874-
_componentName3
16871+
_componentName2
1687516872
);
1687616873

16877-
didWarnAboutDefaultPropsOnFunctionComponent[_componentName3] = true;
16874+
didWarnAboutDefaultPropsOnFunctionComponent[_componentName2] = true;
1687816875
}
1687916876
}
1688016877

1688116878
if (typeof Component.getDerivedStateFromProps === "function") {
16882-
var _componentName4 =
16879+
var _componentName3 =
1688316880
getComponentNameFromType(Component) || "Unknown";
1688416881

1688516882
if (
16886-
!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4]
16883+
!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3]
1688716884
) {
1688816885
error(
1688916886
"%s: Function components do not support getDerivedStateFromProps.",
16890-
_componentName4
16887+
_componentName3
1689116888
);
1689216889

16893-
didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] =
16890+
didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] =
1689416891
true;
1689516892
}
1689616893
}
@@ -16899,16 +16896,16 @@ if (__DEV__) {
1689916896
typeof Component.contextType === "object" &&
1690016897
Component.contextType !== null
1690116898
) {
16902-
var _componentName5 =
16899+
var _componentName4 =
1690316900
getComponentNameFromType(Component) || "Unknown";
1690416901

16905-
if (!didWarnAboutContextTypeOnFunctionComponent[_componentName5]) {
16902+
if (!didWarnAboutContextTypeOnFunctionComponent[_componentName4]) {
1690616903
error(
1690716904
"%s: Function components do not support contextType.",
16908-
_componentName5
16905+
_componentName4
1690916906
);
1691016907

16911-
didWarnAboutContextTypeOnFunctionComponent[_componentName5] = true;
16908+
didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true;
1691216909
}
1691316910
}
1691416911
}

compiled/facebook-www/ReactART-dev.modern.js

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ if (__DEV__) {
6666
return self;
6767
}
6868

69-
var ReactVersion = "19.0.0-www-modern-6b2eae4e";
69+
var ReactVersion = "19.0.0-www-modern-210281fd";
7070

7171
var LegacyRoot = 0;
7272
var ConcurrentRoot = 1;
@@ -16496,30 +16496,27 @@ if (__DEV__) {
1649616496
didWarnAboutModulePatternComponent[_componentName] = true;
1649716497
}
1649816498
}
16499-
}
16499+
} // Proceed under the assumption that this is a function component
1650016500

16501-
{
16502-
// Proceed under the assumption that this is a function component
16503-
workInProgress.tag = FunctionComponent;
16501+
workInProgress.tag = FunctionComponent;
1650416502

16505-
{
16506-
if (Component.contextTypes) {
16507-
error(
16508-
"%s uses the legacy contextTypes API which was removed in React 19. " +
16509-
"Use React.createContext() with React.useContext() instead.",
16510-
getComponentNameFromType(Component) || "Unknown"
16511-
);
16512-
}
16503+
{
16504+
if (Component.contextTypes) {
16505+
error(
16506+
"%s uses the legacy contextTypes API which was removed in React 19. " +
16507+
"Use React.createContext() with React.useContext() instead.",
16508+
getComponentNameFromType(Component) || "Unknown"
16509+
);
1651316510
}
16511+
}
1651416512

16515-
reconcileChildren(null, workInProgress, value, renderLanes);
16513+
reconcileChildren(null, workInProgress, value, renderLanes);
1651616514

16517-
{
16518-
validateFunctionComponentInDev(workInProgress, Component);
16519-
}
16520-
16521-
return workInProgress.child;
16515+
{
16516+
validateFunctionComponentInDev(workInProgress, Component);
1652216517
}
16518+
16519+
return workInProgress.child;
1652316520
}
1652416521

1652516522
function validateFunctionComponentInDev(workInProgress, Component) {
@@ -16558,33 +16555,33 @@ if (__DEV__) {
1655816555
}
1655916556

1656016557
if (Component.defaultProps !== undefined) {
16561-
var _componentName3 =
16558+
var _componentName2 =
1656216559
getComponentNameFromType(Component) || "Unknown";
1656316560

16564-
if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName3]) {
16561+
if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName2]) {
1656516562
error(
1656616563
"%s: Support for defaultProps will be removed from function components " +
1656716564
"in a future major release. Use JavaScript default parameters instead.",
16568-
_componentName3
16565+
_componentName2
1656916566
);
1657016567

16571-
didWarnAboutDefaultPropsOnFunctionComponent[_componentName3] = true;
16568+
didWarnAboutDefaultPropsOnFunctionComponent[_componentName2] = true;
1657216569
}
1657316570
}
1657416571

1657516572
if (typeof Component.getDerivedStateFromProps === "function") {
16576-
var _componentName4 =
16573+
var _componentName3 =
1657716574
getComponentNameFromType(Component) || "Unknown";
1657816575

1657916576
if (
16580-
!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4]
16577+
!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3]
1658116578
) {
1658216579
error(
1658316580
"%s: Function components do not support getDerivedStateFromProps.",
16584-
_componentName4
16581+
_componentName3
1658516582
);
1658616583

16587-
didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] =
16584+
didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] =
1658816585
true;
1658916586
}
1659016587
}
@@ -16593,16 +16590,16 @@ if (__DEV__) {
1659316590
typeof Component.contextType === "object" &&
1659416591
Component.contextType !== null
1659516592
) {
16596-
var _componentName5 =
16593+
var _componentName4 =
1659716594
getComponentNameFromType(Component) || "Unknown";
1659816595

16599-
if (!didWarnAboutContextTypeOnFunctionComponent[_componentName5]) {
16596+
if (!didWarnAboutContextTypeOnFunctionComponent[_componentName4]) {
1660016597
error(
1660116598
"%s: Function components do not support contextType.",
16602-
_componentName5
16599+
_componentName4
1660316600
);
1660416601

16605-
didWarnAboutContextTypeOnFunctionComponent[_componentName5] = true;
16602+
didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true;
1660616603
}
1660716604
}
1660816605
}

compiled/facebook-www/ReactART-prod.classic.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5633,8 +5633,7 @@ function beginWork(current, workInProgress, renderLanes) {
56335633
workInProgress.flags |= 1;
56345634
workInProgress.tag = 0;
56355635
reconcileChildren(null, workInProgress, current, renderLanes);
5636-
workInProgress = workInProgress.child;
5637-
return workInProgress;
5636+
return workInProgress.child;
56385637
case 16:
56395638
Component = workInProgress.elementType;
56405639
a: {
@@ -10617,7 +10616,7 @@ var slice = Array.prototype.slice,
1061710616
return null;
1061810617
},
1061910618
bundleType: 0,
10620-
version: "19.0.0-www-classic-1ca45163",
10619+
version: "19.0.0-www-classic-03341623",
1062110620
rendererPackageName: "react-art"
1062210621
};
1062310622
var internals$jscomp$inline_1324 = {
@@ -10648,7 +10647,7 @@ var internals$jscomp$inline_1324 = {
1064810647
scheduleRoot: null,
1064910648
setRefreshHandler: null,
1065010649
getCurrentFiber: null,
10651-
reconcilerVersion: "19.0.0-www-classic-1ca45163"
10650+
reconcilerVersion: "19.0.0-www-classic-03341623"
1065210651
};
1065310652
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1065410653
var hook$jscomp$inline_1325 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled/facebook-www/ReactART-prod.modern.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5371,8 +5371,7 @@ function beginWork(current, workInProgress, renderLanes) {
53715371
workInProgress.flags |= 1;
53725372
workInProgress.tag = 0;
53735373
reconcileChildren(null, workInProgress, current, renderLanes);
5374-
workInProgress = workInProgress.child;
5375-
return workInProgress;
5374+
return workInProgress.child;
53765375
case 16:
53775376
Component = workInProgress.elementType;
53785377
a: {
@@ -10272,7 +10271,7 @@ var slice = Array.prototype.slice,
1027210271
return null;
1027310272
},
1027410273
bundleType: 0,
10275-
version: "19.0.0-www-modern-ba56ad23",
10274+
version: "19.0.0-www-modern-672a54bb",
1027610275
rendererPackageName: "react-art"
1027710276
};
1027810277
var internals$jscomp$inline_1304 = {
@@ -10303,7 +10302,7 @@ var internals$jscomp$inline_1304 = {
1030310302
scheduleRoot: null,
1030410303
setRefreshHandler: null,
1030510304
getCurrentFiber: null,
10306-
reconcilerVersion: "19.0.0-www-modern-ba56ad23"
10305+
reconcilerVersion: "19.0.0-www-modern-672a54bb"
1030710306
};
1030810307
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1030910308
var hook$jscomp$inline_1305 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled/facebook-www/ReactDOM-dev.classic.js

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -21796,24 +21796,21 @@ if (__DEV__) {
2179621796
didWarnAboutModulePatternComponent[_componentName] = true;
2179721797
}
2179821798
}
21799-
}
21799+
} // Proceed under the assumption that this is a function component
2180021800

21801-
{
21802-
// Proceed under the assumption that this is a function component
21803-
workInProgress.tag = FunctionComponent;
21801+
workInProgress.tag = FunctionComponent;
2180421802

21805-
if (getIsHydrating() && hasId) {
21806-
pushMaterializedTreeId(workInProgress);
21807-
}
21808-
21809-
reconcileChildren(null, workInProgress, value, renderLanes);
21803+
if (getIsHydrating() && hasId) {
21804+
pushMaterializedTreeId(workInProgress);
21805+
}
2181021806

21811-
{
21812-
validateFunctionComponentInDev(workInProgress, Component);
21813-
}
21807+
reconcileChildren(null, workInProgress, value, renderLanes);
2181421808

21815-
return workInProgress.child;
21809+
{
21810+
validateFunctionComponentInDev(workInProgress, Component);
2181621811
}
21812+
21813+
return workInProgress.child;
2181721814
}
2181821815

2181921816
function validateFunctionComponentInDev(workInProgress, Component) {
@@ -21852,33 +21849,33 @@ if (__DEV__) {
2185221849
}
2185321850

2185421851
if (Component.defaultProps !== undefined) {
21855-
var _componentName3 =
21852+
var _componentName2 =
2185621853
getComponentNameFromType(Component) || "Unknown";
2185721854

21858-
if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName3]) {
21855+
if (!didWarnAboutDefaultPropsOnFunctionComponent[_componentName2]) {
2185921856
error(
2186021857
"%s: Support for defaultProps will be removed from function components " +
2186121858
"in a future major release. Use JavaScript default parameters instead.",
21862-
_componentName3
21859+
_componentName2
2186321860
);
2186421861

21865-
didWarnAboutDefaultPropsOnFunctionComponent[_componentName3] = true;
21862+
didWarnAboutDefaultPropsOnFunctionComponent[_componentName2] = true;
2186621863
}
2186721864
}
2186821865

2186921866
if (typeof Component.getDerivedStateFromProps === "function") {
21870-
var _componentName4 =
21867+
var _componentName3 =
2187121868
getComponentNameFromType(Component) || "Unknown";
2187221869

2187321870
if (
21874-
!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4]
21871+
!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3]
2187521872
) {
2187621873
error(
2187721874
"%s: Function components do not support getDerivedStateFromProps.",
21878-
_componentName4
21875+
_componentName3
2187921876
);
2188021877

21881-
didWarnAboutGetDerivedStateOnFunctionComponent[_componentName4] =
21878+
didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] =
2188221879
true;
2188321880
}
2188421881
}
@@ -21887,16 +21884,16 @@ if (__DEV__) {
2188721884
typeof Component.contextType === "object" &&
2188821885
Component.contextType !== null
2188921886
) {
21890-
var _componentName5 =
21887+
var _componentName4 =
2189121888
getComponentNameFromType(Component) || "Unknown";
2189221889

21893-
if (!didWarnAboutContextTypeOnFunctionComponent[_componentName5]) {
21890+
if (!didWarnAboutContextTypeOnFunctionComponent[_componentName4]) {
2189421891
error(
2189521892
"%s: Function components do not support contextType.",
21896-
_componentName5
21893+
_componentName4
2189721894
);
2189821895

21899-
didWarnAboutContextTypeOnFunctionComponent[_componentName5] = true;
21896+
didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true;
2190021897
}
2190121898
}
2190221899
}
@@ -36351,7 +36348,7 @@ if (__DEV__) {
3635136348
return root;
3635236349
}
3635336350

36354-
var ReactVersion = "19.0.0-www-classic-31c745b2";
36351+
var ReactVersion = "19.0.0-www-classic-ad0567f0";
3635536352

3635636353
function createPortal$1(
3635736354
children,

0 commit comments

Comments
 (0)