Skip to content

Commit 9dc1a1b

Browse files
committed
[compiler] @enablePreserveExistingMemoizationGuarantees on by default (#34689)
This enables `@enablePreserveExistingMemoizationGuarantees` by default. As of the previous PR (#34503), this mode now enables the following behaviors: - Treating variables referenced within a `useMemo()` or `useCallback()` as "frozen" (immutable) as of the start of the call. Ie, the compiler will assume that the values you reference are not mutated by the body of the useMemo, not are they mutated later. Directly modifying them (eg `var.property = true`) will be an error. - Similarly, the results of the useMemo/useCallback are treated as frozen (immutable) after the call. These two rules match the behavior for other hooks: this means that developers will see similar behavior to swapping out `useMemo()` for a custom `useMyMemo()` wrapper/alias. Additionally, as of #34503 the compiler uses information from the manual dependencies to know which variables are non-nullable. Even if a useMemo block conditionally accesses a nested property — `if (cond) { log(x.y.z) }` — where the compiler would not usually know that `x` is non-nullable, if the user specifies `x.y.z` as a manual dependency then the compiler knows that `x` and `x.y` are non-nullable and can infer a more precise dependency. Finally, this mode also ensures that we always memoize function calls that return primitives. See #34343 for more details. For now, I've explicitly opted out of this feature in all test fixtures where the behavior changed. DiffTrain build for [70b52be](70b52be)
1 parent def8123 commit 9dc1a1b

26 files changed

+91
-91
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-57d5a597-20251002
1+
19.3.0-native-fb-70b52bec-20251002

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<<44a58f1c25f5d340803e6a2f02d44d58>>
10+
* @generated SignedSource<<d1fc4aed12fe501dc3236e12a925d762>>
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-57d5a597-20251002";
407+
exports.version = "19.3.0-native-fb-70b52bec-20251002";
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<<d4734ed2e0b7fa344b87331c99ca6536>>
10+
* @generated SignedSource<<f38fc0148dfbff6da655b33c1524921e>>
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-57d5a597-20251002";
206+
exports.version = "19.3.0-native-fb-70b52bec-20251002";

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<<d4734ed2e0b7fa344b87331c99ca6536>>
10+
* @generated SignedSource<<f38fc0148dfbff6da655b33c1524921e>>
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-57d5a597-20251002";
206+
exports.version = "19.3.0-native-fb-70b52bec-20251002";

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<<91b00c527532a1488188e3b7fba59e1d>>
10+
* @generated SignedSource<<9546933ccd69ece5525d2758b03df590>>
1111
*/
1212

1313
/*
@@ -30061,11 +30061,11 @@ __DEV__ &&
3006130061
};
3006230062
(function () {
3006330063
var isomorphicReactPackageVersion = React.version;
30064-
if ("19.3.0-native-fb-57d5a597-20251002" !== isomorphicReactPackageVersion)
30064+
if ("19.3.0-native-fb-70b52bec-20251002" !== isomorphicReactPackageVersion)
3006530065
throw Error(
3006630066
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
3006730067
(isomorphicReactPackageVersion +
30068-
"\n - react-dom: 19.3.0-native-fb-57d5a597-20251002\nLearn more: https://react.dev/warnings/version-mismatch")
30068+
"\n - react-dom: 19.3.0-native-fb-70b52bec-20251002\nLearn more: https://react.dev/warnings/version-mismatch")
3006930069
);
3007030070
})();
3007130071
("function" === typeof Map &&
@@ -30102,10 +30102,10 @@ __DEV__ &&
3010230102
!(function () {
3010330103
var internals = {
3010430104
bundleType: 1,
30105-
version: "19.3.0-native-fb-57d5a597-20251002",
30105+
version: "19.3.0-native-fb-70b52bec-20251002",
3010630106
rendererPackageName: "react-dom",
3010730107
currentDispatcherRef: ReactSharedInternals,
30108-
reconcilerVersion: "19.3.0-native-fb-57d5a597-20251002"
30108+
reconcilerVersion: "19.3.0-native-fb-70b52bec-20251002"
3010930109
};
3011030110
internals.overrideHookState = overrideHookState;
3011130111
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -30255,5 +30255,5 @@ __DEV__ &&
3025530255
listenToAllSupportedEvents(container);
3025630256
return new ReactDOMHydrationRoot(initialChildren);
3025730257
};
30258-
exports.version = "19.3.0-native-fb-57d5a597-20251002";
30258+
exports.version = "19.3.0-native-fb-70b52bec-20251002";
3025930259
})();

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<<11b6ad11c4ce1326f6620ffcd53ce388>>
10+
* @generated SignedSource<<875025a4097f96a8980d4ea05c12d2b8>>
1111
*/
1212

1313
/*
@@ -17578,14 +17578,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1757817578
};
1757917579
var isomorphicReactPackageVersion$jscomp$inline_2059 = React.version;
1758017580
if (
17581-
"19.3.0-native-fb-57d5a597-20251002" !==
17581+
"19.3.0-native-fb-70b52bec-20251002" !==
1758217582
isomorphicReactPackageVersion$jscomp$inline_2059
1758317583
)
1758417584
throw Error(
1758517585
formatProdErrorMessage(
1758617586
527,
1758717587
isomorphicReactPackageVersion$jscomp$inline_2059,
17588-
"19.3.0-native-fb-57d5a597-20251002"
17588+
"19.3.0-native-fb-70b52bec-20251002"
1758917589
)
1759017590
);
1759117591
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17607,10 +17607,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1760717607
};
1760817608
var internals$jscomp$inline_2636 = {
1760917609
bundleType: 0,
17610-
version: "19.3.0-native-fb-57d5a597-20251002",
17610+
version: "19.3.0-native-fb-70b52bec-20251002",
1761117611
rendererPackageName: "react-dom",
1761217612
currentDispatcherRef: ReactSharedInternals,
17613-
reconcilerVersion: "19.3.0-native-fb-57d5a597-20251002"
17613+
reconcilerVersion: "19.3.0-native-fb-70b52bec-20251002"
1761417614
};
1761517615
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1761617616
var hook$jscomp$inline_2637 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -17717,4 +17717,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1771717717
listenToAllSupportedEvents(container);
1771817718
return new ReactDOMHydrationRoot(initialChildren);
1771917719
};
17720-
exports.version = "19.3.0-native-fb-57d5a597-20251002";
17720+
exports.version = "19.3.0-native-fb-70b52bec-20251002";

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<<3f4913ddb2ace3afebef375803f9c060>>
10+
* @generated SignedSource<<b35b43c6f304f05e9a992bbb417f61e9>>
1111
*/
1212

1313
/*
@@ -19716,14 +19716,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1971619716
};
1971719717
var isomorphicReactPackageVersion$jscomp$inline_2374 = React.version;
1971819718
if (
19719-
"19.3.0-native-fb-57d5a597-20251002" !==
19719+
"19.3.0-native-fb-70b52bec-20251002" !==
1972019720
isomorphicReactPackageVersion$jscomp$inline_2374
1972119721
)
1972219722
throw Error(
1972319723
formatProdErrorMessage(
1972419724
527,
1972519725
isomorphicReactPackageVersion$jscomp$inline_2374,
19726-
"19.3.0-native-fb-57d5a597-20251002"
19726+
"19.3.0-native-fb-70b52bec-20251002"
1972719727
)
1972819728
);
1972919729
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -19745,10 +19745,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1974519745
};
1974619746
var internals$jscomp$inline_2381 = {
1974719747
bundleType: 0,
19748-
version: "19.3.0-native-fb-57d5a597-20251002",
19748+
version: "19.3.0-native-fb-70b52bec-20251002",
1974919749
rendererPackageName: "react-dom",
1975019750
currentDispatcherRef: ReactSharedInternals,
19751-
reconcilerVersion: "19.3.0-native-fb-57d5a597-20251002",
19751+
reconcilerVersion: "19.3.0-native-fb-70b52bec-20251002",
1975219752
getLaneLabelMap: function () {
1975319753
for (
1975419754
var map = new Map(), lane = 1, index$331 = 0;
@@ -19871,4 +19871,4 @@ exports.hydrateRoot = function (container, initialChildren, options) {
1987119871
listenToAllSupportedEvents(container);
1987219872
return new ReactDOMHydrationRoot(initialChildren);
1987319873
};
19874-
exports.version = "19.3.0-native-fb-57d5a597-20251002";
19874+
exports.version = "19.3.0-native-fb-70b52bec-20251002";

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<<dc93e27f80d641970f9c9b52e8c38767>>
10+
* @generated SignedSource<<a317e40dd4022849732dab2529c2dbe7>>
1111
*/
1212

1313
/*
@@ -30117,11 +30117,11 @@ __DEV__ &&
3011730117
};
3011830118
(function () {
3011930119
var isomorphicReactPackageVersion = React.version;
30120-
if ("19.3.0-native-fb-57d5a597-20251002" !== isomorphicReactPackageVersion)
30120+
if ("19.3.0-native-fb-70b52bec-20251002" !== isomorphicReactPackageVersion)
3012130121
throw Error(
3012230122
'Incompatible React versions: The "react" and "react-dom" packages must have the exact same version. Instead got:\n - react: ' +
3012330123
(isomorphicReactPackageVersion +
30124-
"\n - react-dom: 19.3.0-native-fb-57d5a597-20251002\nLearn more: https://react.dev/warnings/version-mismatch")
30124+
"\n - react-dom: 19.3.0-native-fb-70b52bec-20251002\nLearn more: https://react.dev/warnings/version-mismatch")
3012530125
);
3012630126
})();
3012730127
("function" === typeof Map &&
@@ -30158,10 +30158,10 @@ __DEV__ &&
3015830158
!(function () {
3015930159
var internals = {
3016030160
bundleType: 1,
30161-
version: "19.3.0-native-fb-57d5a597-20251002",
30161+
version: "19.3.0-native-fb-70b52bec-20251002",
3016230162
rendererPackageName: "react-dom",
3016330163
currentDispatcherRef: ReactSharedInternals,
30164-
reconcilerVersion: "19.3.0-native-fb-57d5a597-20251002"
30164+
reconcilerVersion: "19.3.0-native-fb-70b52bec-20251002"
3016530165
};
3016630166
internals.overrideHookState = overrideHookState;
3016730167
internals.overrideHookStateDeletePath = overrideHookStateDeletePath;
@@ -30627,7 +30627,7 @@ __DEV__ &&
3062730627
exports.useFormStatus = function () {
3062830628
return resolveDispatcher().useHostTransitionStatus();
3062930629
};
30630-
exports.version = "19.3.0-native-fb-57d5a597-20251002";
30630+
exports.version = "19.3.0-native-fb-70b52bec-20251002";
3063130631
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
3063230632
"function" ===
3063330633
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<<4ff8a16c21a2635e6f0d627adcfbccdf>>
10+
* @generated SignedSource<<8f1f3a3b5a63a6ba1d47e3f384425423>>
1111
*/
1212

1313
/*
@@ -17589,14 +17589,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1758917589
};
1759017590
var isomorphicReactPackageVersion$jscomp$inline_2060 = React.version;
1759117591
if (
17592-
"19.3.0-native-fb-57d5a597-20251002" !==
17592+
"19.3.0-native-fb-70b52bec-20251002" !==
1759317593
isomorphicReactPackageVersion$jscomp$inline_2060
1759417594
)
1759517595
throw Error(
1759617596
formatProdErrorMessage(
1759717597
527,
1759817598
isomorphicReactPackageVersion$jscomp$inline_2060,
17599-
"19.3.0-native-fb-57d5a597-20251002"
17599+
"19.3.0-native-fb-70b52bec-20251002"
1760017600
)
1760117601
);
1760217602
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -17618,10 +17618,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1761817618
};
1761917619
var internals$jscomp$inline_2639 = {
1762017620
bundleType: 0,
17621-
version: "19.3.0-native-fb-57d5a597-20251002",
17621+
version: "19.3.0-native-fb-70b52bec-20251002",
1762217622
rendererPackageName: "react-dom",
1762317623
currentDispatcherRef: ReactSharedInternals,
17624-
reconcilerVersion: "19.3.0-native-fb-57d5a597-20251002"
17624+
reconcilerVersion: "19.3.0-native-fb-70b52bec-20251002"
1762517625
};
1762617626
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
1762717627
var hook$jscomp$inline_2640 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
@@ -17881,4 +17881,4 @@ exports.useFormState = function (action, initialState, permalink) {
1788117881
exports.useFormStatus = function () {
1788217882
return ReactSharedInternals.H.useHostTransitionStatus();
1788317883
};
17884-
exports.version = "19.3.0-native-fb-57d5a597-20251002";
17884+
exports.version = "19.3.0-native-fb-70b52bec-20251002";

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<<270cae553112e9c9d9146f1123e105ca>>
10+
* @generated SignedSource<<785a30774381eef3422773090d816420>>
1111
*/
1212

1313
/*
@@ -19731,14 +19731,14 @@ ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = function (target) {
1973119731
};
1973219732
var isomorphicReactPackageVersion$jscomp$inline_2375 = React.version;
1973319733
if (
19734-
"19.3.0-native-fb-57d5a597-20251002" !==
19734+
"19.3.0-native-fb-70b52bec-20251002" !==
1973519735
isomorphicReactPackageVersion$jscomp$inline_2375
1973619736
)
1973719737
throw Error(
1973819738
formatProdErrorMessage(
1973919739
527,
1974019740
isomorphicReactPackageVersion$jscomp$inline_2375,
19741-
"19.3.0-native-fb-57d5a597-20251002"
19741+
"19.3.0-native-fb-70b52bec-20251002"
1974219742
)
1974319743
);
1974419744
ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
@@ -19760,10 +19760,10 @@ ReactDOMSharedInternals.findDOMNode = function (componentOrElement) {
1976019760
};
1976119761
var internals$jscomp$inline_2382 = {
1976219762
bundleType: 0,
19763-
version: "19.3.0-native-fb-57d5a597-20251002",
19763+
version: "19.3.0-native-fb-70b52bec-20251002",
1976419764
rendererPackageName: "react-dom",
1976519765
currentDispatcherRef: ReactSharedInternals,
19766-
reconcilerVersion: "19.3.0-native-fb-57d5a597-20251002",
19766+
reconcilerVersion: "19.3.0-native-fb-70b52bec-20251002",
1976719767
getLaneLabelMap: function () {
1976819768
for (
1976919769
var map = new Map(), lane = 1, index$331 = 0;
@@ -20039,7 +20039,7 @@ exports.useFormState = function (action, initialState, permalink) {
2003920039
exports.useFormStatus = function () {
2004020040
return ReactSharedInternals.H.useHostTransitionStatus();
2004120041
};
20042-
exports.version = "19.3.0-native-fb-57d5a597-20251002";
20042+
exports.version = "19.3.0-native-fb-70b52bec-20251002";
2004320043
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
2004420044
"function" ===
2004520045
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&

0 commit comments

Comments
 (0)