Skip to content

Commit dc26b58

Browse files
committed
[Compiler] Avoid capturing global setStates for no-derived-computations lint (facebook#35135)
Summary: This only matters when enableTreatSetIdentifiersAsStateSetters=true This pattern is still bad. But Right now the validation can only recommend to move stuff to "calculate in render" A global setState should not be moved to render, not even conditionally and you can't remove state without crossing Component boundaries, which makes this a different kind of fix. So while we are only suggesting "calculate in render" as a fix we should disallow the lint from throwing in this case IMO Test Plan: Added a fixture --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/35135). * __->__ facebook#35135 * facebook#35134 DiffTrain build for [257b033](facebook@257b033)
1 parent ec9490a commit dc26b58

23 files changed

+130
-88
lines changed

compiled-rn/VERSION_NATIVE_FB

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
19.3.0-native-fb-93fc5740-20251113
1+
19.3.0-native-fb-257b033f-20251113

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-dev.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<999d3c9c2317233c8d99ed68497e5db2>>
10+
* @generated SignedSource<<7dbfc487dfe2d62bd3d68a32eefb11c6>>
1111
*/
1212

1313
"use strict";
@@ -404,5 +404,5 @@ __DEV__ &&
404404
exports.useFormStatus = function () {
405405
return resolveDispatcher().useHostTransitionStatus();
406406
};
407-
exports.version = "19.3.0-native-fb-93fc5740-20251113";
407+
exports.version = "19.3.0-native-fb-257b033f-20251113";
408408
})();

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<fcced61322caf0a0a2c299b3193730c1>>
10+
* @generated SignedSource<<ba9dc57e03a07fba309ad1eeee0535c0>>
1111
*/
1212

1313
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
203203
exports.useFormStatus = function () {
204204
return ReactSharedInternals.H.useHostTransitionStatus();
205205
};
206-
exports.version = "19.3.0-native-fb-93fc5740-20251113";
206+
exports.version = "19.3.0-native-fb-257b033f-20251113";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOM-profiling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<fcced61322caf0a0a2c299b3193730c1>>
10+
* @generated SignedSource<<ba9dc57e03a07fba309ad1eeee0535c0>>
1111
*/
1212

1313
"use strict";
@@ -203,4 +203,4 @@ exports.useFormState = function (action, initialState, permalink) {
203203
exports.useFormStatus = function () {
204204
return ReactSharedInternals.H.useHostTransitionStatus();
205205
};
206-
exports.version = "19.3.0-native-fb-93fc5740-20251113";
206+
exports.version = "19.3.0-native-fb-257b033f-20251113";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-dev.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<2a6d047b91f4e7be0b0d6d4395a1f0ee>>
10+
* @generated SignedSource<<baa29565a106948ead6c1c6c990fee7a>>
1111
*/
1212

1313
/*
@@ -30242,11 +30242,11 @@ __DEV__ &&
3024230242
};
3024330243
(function () {
3024430244
var isomorphicReactPackageVersion = React.version;
30245-
if ("19.3.0-native-fb-93fc5740-20251113" !== isomorphicReactPackageVersion)
30245+
if ("19.3.0-native-fb-257b033f-20251113" !== isomorphicReactPackageVersion)
3024630246
throw Error(
3024730247
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
3024830248
(isomorphicReactPackageVersion +
30249-
"\n - react-dom: 19.3.0-native-fb-93fc5740-20251113\nLearn more: https://react.dev/warnings/version-mismatch")
30249+
"\n - react-dom: 19.3.0-native-fb-257b033f-20251113\nLearn more: https://react.dev/warnings/version-mismatch")
3025030250
);
3025130251
})();
3025230252
("function" === typeof Map &&
@@ -30283,10 +30283,10 @@ __DEV__ &&
3028330283
!(function () {
3028430284
var internals = {
3028530285
bundleType: 1,
30286-
version: "19.3.0-native-fb-93fc5740-20251113",
30286+
version: "19.3.0-native-fb-257b033f-20251113",
3028730287
rendererPackageName: "react-dom",
3028830288
currentDispatcherRef: ReactSharedInternals,
30289-
reconcilerVersion: "19.3.0-native-fb-93fc5740-20251113"
30289+
reconcilerVersion: "19.3.0-native-fb-257b033f-20251113"
3029030290
};
3029130291
internals.overrideHookState = overrideHookState;
3029230292
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -30436,5 +30436,5 @@ __DEV__ &&
3043630436
listenToAllSupportedEvents(container);
3043730437
return new ReactDOMHydrationRoot(initialChildren);
3043830438
};
30439-
exports.version = "19.3.0-native-fb-93fc5740-20251113";
30439+
exports.version = "19.3.0-native-fb-257b033f-20251113";
3044030440
})();

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-prod.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<7d4763b3fb9ff2dad435f3671e195b37>>
10+
* @generated SignedSource<<839f996d90be0805d79ea1e01eea9d94>>
1111
*/
1212

1313
/*
@@ -17702,14 +17702,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1770217702
};
1770317703
var isomorphicReactPackageVersion$jscomp$inline_2054 = React.version;
1770417704
if (
17705-
"19.3.0-native-fb-93fc5740-20251113" !==
17705+
"19.3.0-native-fb-257b033f-20251113" !==
1770617706
isomorphicReactPackageVersion$jscomp$inline_2054
1770717707
)
1770817708
throw Error(
1770917709
formatProdErrorMessage(
1771017710
527,
1771117711
isomorphicReactPackageVersion$jscomp$inline_2054,
17712-
"19.3.0-native-fb-93fc5740-20251113"
17712+
"19.3.0-native-fb-257b033f-20251113"
1771317713
)
1771417714
);
1771517715
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17731,10 +17731,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1773117731
};
1773217732
var internals$jscomp$inline_2636 = {
1773317733
bundleType: 0,
17734-
version: "19.3.0-native-fb-93fc5740-20251113",
17734+
version: "19.3.0-native-fb-257b033f-20251113",
1773517735
rendererPackageName: "react-dom",
1773617736
currentDispatcherRef: ReactSharedInternals,
17737-
reconcilerVersion: "19.3.0-native-fb-93fc5740-20251113"
17737+
reconcilerVersion: "19.3.0-native-fb-257b033f-20251113"
1773817738
};
1773917739
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1774017740
var hook$jscomp$inline_2637 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -17841,4 +17841,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1784117841
listenToAllSupportedEvents(container);
1784217842
return new ReactDOMHydrationRoot(initialChildren);
1784317843
};
17844-
exports.version = "19.3.0-native-fb-93fc5740-20251113";
17844+
exports.version = "19.3.0-native-fb-257b033f-20251113";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMClient-profiling.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<cbc3536f1eeedda1472c094e3679c71d>>
10+
* @generated SignedSource<<56f2d628542d51b755a46eb6b38a8422>>
1111
*/
1212

1313
/*
@@ -19828,14 +19828,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1982819828
};
1982919829
var isomorphicReactPackageVersion$jscomp$inline_2369 = React.version;
1983019830
if (
19831-
"19.3.0-native-fb-93fc5740-20251113" !==
19831+
"19.3.0-native-fb-257b033f-20251113" !==
1983219832
isomorphicReactPackageVersion$jscomp$inline_2369
1983319833
)
1983419834
throw Error(
1983519835
formatProdErrorMessage(
1983619836
527,
1983719837
isomorphicReactPackageVersion$jscomp$inline_2369,
19838-
"19.3.0-native-fb-93fc5740-20251113"
19838+
"19.3.0-native-fb-257b033f-20251113"
1983919839
)
1984019840
);
1984119841
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -19857,10 +19857,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1985719857
};
1985819858
var internals$jscomp$inline_2376 = {
1985919859
bundleType: 0,
19860-
version: "19.3.0-native-fb-93fc5740-20251113",
19860+
version: "19.3.0-native-fb-257b033f-20251113",
1986119861
rendererPackageName: "react-dom",
1986219862
currentDispatcherRef: ReactSharedInternals,
19863-
reconcilerVersion: "19.3.0-native-fb-93fc5740-20251113",
19863+
reconcilerVersion: "19.3.0-native-fb-257b033f-20251113",
1986419864
getLaneLabelMap: function () {
1986519865
for (
1986619866
var map = new Map(), lane = 1, index$336 = 0;
@@ -19983,4 +19983,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1998319983
listenToAllSupportedEvents(container);
1998419984
return new ReactDOMHydrationRoot(initialChildren);
1998519985
};
19986-
exports.version = "19.3.0-native-fb-93fc5740-20251113";
19986+
exports.version = "19.3.0-native-fb-257b033f-20251113";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-dev.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<ffbfb9d305b0a47195f46c79c4b3e0e6>>
10+
* @generated SignedSource<<d164efa6ec482b2dc08a9848c7976c10>>
1111
*/
1212

1313
/*
@@ -30298,11 +30298,11 @@ __DEV__ &&
3029830298
};
3029930299
(function () {
3030030300
var isomorphicReactPackageVersion = React.version;
30301-
if ("19.3.0-native-fb-93fc5740-20251113" !== isomorphicReactPackageVersion)
30301+
if ("19.3.0-native-fb-257b033f-20251113" !== isomorphicReactPackageVersion)
3030230302
throw Error(
3030330303
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
3030430304
(isomorphicReactPackageVersion +
30305-
"\n - react-dom: 19.3.0-native-fb-93fc5740-20251113\nLearn more: https://react.dev/warnings/version-mismatch")
30305+
"\n - react-dom: 19.3.0-native-fb-257b033f-20251113\nLearn more: https://react.dev/warnings/version-mismatch")
3030630306
);
3030730307
})();
3030830308
("function" === typeof Map &&
@@ -30339,10 +30339,10 @@ __DEV__ &&
3033930339
!(function () {
3034030340
var internals = {
3034130341
bundleType: 1,
30342-
version: "19.3.0-native-fb-93fc5740-20251113",
30342+
version: "19.3.0-native-fb-257b033f-20251113",
3034330343
rendererPackageName: "react-dom",
3034430344
currentDispatcherRef: ReactSharedInternals,
30345-
reconcilerVersion: "19.3.0-native-fb-93fc5740-20251113"
30345+
reconcilerVersion: "19.3.0-native-fb-257b033f-20251113"
3034630346
};
3034730347
internals.overrideHookState = overrideHookState;
3034830348
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -30808,7 +30808,7 @@ __DEV__ &&
3080830808
exports.useFormStatus = function () {
3080930809
return resolveDispatcher().useHostTransitionStatus();
3081030810
};
30811-
exports.version = "19.3.0-native-fb-93fc5740-20251113";
30811+
exports.version = "19.3.0-native-fb-257b033f-20251113";
3081230812
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
3081330813
"function" ===
3081430814
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-prod.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<7399cd27dca5e363bc7d0b657b9d4132>>
10+
* @generated SignedSource<<b8494129eae9e4a0ac529f6dff8c23e3>>
1111
*/
1212

1313
/*
@@ -17713,14 +17713,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1771317713
};
1771417714
var isomorphicReactPackageVersion$jscomp$inline_2055 = React.version;
1771517715
if (
17716-
"19.3.0-native-fb-93fc5740-20251113" !==
17716+
"19.3.0-native-fb-257b033f-20251113" !==
1771717717
isomorphicReactPackageVersion$jscomp$inline_2055
1771817718
)
1771917719
throw Error(
1772017720
formatProdErrorMessage(
1772117721
527,
1772217722
isomorphicReactPackageVersion$jscomp$inline_2055,
17723-
"19.3.0-native-fb-93fc5740-20251113"
17723+
"19.3.0-native-fb-257b033f-20251113"
1772417724
)
1772517725
);
1772617726
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17742,10 +17742,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1774217742
};
1774317743
var internals$jscomp$inline_2639 = {
1774417744
bundleType: 0,
17745-
version: "19.3.0-native-fb-93fc5740-20251113",
17745+
version: "19.3.0-native-fb-257b033f-20251113",
1774617746
rendererPackageName: "react-dom",
1774717747
currentDispatcherRef: ReactSharedInternals,
17748-
reconcilerVersion: "19.3.0-native-fb-93fc5740-20251113"
17748+
reconcilerVersion: "19.3.0-native-fb-257b033f-20251113"
1774917749
};
1775017750
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1775117751
var hook$jscomp$inline_2640 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -18005,4 +18005,4 @@ exports.useFormState = function (action, initialState, permalink) {
1800518005
exports.useFormStatus = function () {
1800618006
return ReactSharedInternals.H.useHostTransitionStatus();
1800718007
};
18008-
exports.version = "19.3.0-native-fb-93fc5740-20251113";
18008+
exports.version = "19.3.0-native-fb-257b033f-20251113";

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react/react-dom/cjs/ReactDOMProfiling-profiling.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<4670ab115112abf251cf565636883e4a>>
10+
* @generated SignedSource<<1f68cb76f58db9b2d03b16145eae19c4>>
1111
*/
1212

1313
/*
@@ -19843,14 +19843,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1984319843
};
1984419844
var isomorphicReactPackageVersion$jscomp$inline_2370 = React.version;
1984519845
if (
19846-
"19.3.0-native-fb-93fc5740-20251113" !==
19846+
"19.3.0-native-fb-257b033f-20251113" !==
1984719847
isomorphicReactPackageVersion$jscomp$inline_2370
1984819848
)
1984919849
throw Error(
1985019850
formatProdErrorMessage(
1985119851
527,
1985219852
isomorphicReactPackageVersion$jscomp$inline_2370,
19853-
"19.3.0-native-fb-93fc5740-20251113"
19853+
"19.3.0-native-fb-257b033f-20251113"
1985419854
)
1985519855
);
1985619856
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -19872,10 +19872,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1987219872
};
1987319873
var internals$jscomp$inline_2377 = {
1987419874
bundleType: 0,
19875-
version: "19.3.0-native-fb-93fc5740-20251113",
19875+
version: "19.3.0-native-fb-257b033f-20251113",
1987619876
rendererPackageName: "react-dom",
1987719877
currentDispatcherRef: ReactSharedInternals,
19878-
reconcilerVersion: "19.3.0-native-fb-93fc5740-20251113",
19878+
reconcilerVersion: "19.3.0-native-fb-257b033f-20251113",
1987919879
getLaneLabelMap: function () {
1988019880
for (
1988119881
var map = new Map(), lane = 1, index$336 = 0;
@@ -20151,7 +20151,7 @@ exports.useFormState = function (action, initialState, permalink) {
2015120151
exports.useFormStatus = function () {
2015220152
return ReactSharedInternals.H.useHostTransitionStatus();
2015320153
};
20154-
exports.version = "19.3.0-native-fb-93fc5740-20251113";
20154+
exports.version = "19.3.0-native-fb-257b033f-20251113";
2015520155
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2015620156
"function" ===
2015720157
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)