Skip to content

Commit

Permalink
[compiler] Option for preserving calls to useMemo/useCallback
Browse files Browse the repository at this point in the history
Summary: This adds a compiler option to not drop existing manual memoization and leaving useMemo/useCallback in the generated source. Why do we need this, given that we also have options to validate or ensure that existing memoization is preserved? It's because later diffs on this stack are designed to alter the behavior of the memoization that the compiler emits, in order to detect rules of react violations and debug issues. We don't want to change the behavior of user-level memoization, however, since doing so would be altering the semantics of the user's program in an unacceptable way.

ghstack-source-id: 89dccdec9ccb4306b16e849e9fa2170bb5dd021f
Pull Request resolved: #29654

DiffTrain build for commit 28fe581.
  • Loading branch information
mvitousek committed May 31, 2024
1 parent 57368ce commit d0d9492
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<7717760950739b06579fee20705a4f3f>>
* @generated SignedSource<<d9285fd06971a6f9cfc18fa70dc67a2b>>
*/

'use strict';
Expand Down Expand Up @@ -23471,7 +23471,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-rc-8bc81ca90f-20240531';
var ReactVersion = '19.0.0-rc-28fe581bac-20240531';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<a1650d8a7f2f830d687b1fee2265cb8f>>
* @generated SignedSource<<57e88f8e6d00adbb37f13703f55d92ea>>
*/

"use strict";
Expand Down Expand Up @@ -9298,7 +9298,7 @@ var devToolsConfig$jscomp$inline_1047 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "19.0.0-rc-8bc81ca90f-20240531",
version: "19.0.0-rc-28fe581bac-20240531",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1234 = {
Expand Down Expand Up @@ -9329,7 +9329,7 @@ var internals$jscomp$inline_1234 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-8bc81ca90f-20240531"
reconcilerVersion: "19.0.0-rc-28fe581bac-20240531"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1235 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<4654c4498212fa1e7af6fd1ddea4716b>>
* @generated SignedSource<<37b7169a75924b061b2b0339859ab8ca>>
*/

"use strict";
Expand Down Expand Up @@ -9920,7 +9920,7 @@ var devToolsConfig$jscomp$inline_1130 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "19.0.0-rc-8bc81ca90f-20240531",
version: "19.0.0-rc-28fe581bac-20240531",
rendererPackageName: "react-test-renderer"
};
(function (internals) {
Expand Down Expand Up @@ -9964,7 +9964,7 @@ var devToolsConfig$jscomp$inline_1130 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-8bc81ca90f-20240531"
reconcilerVersion: "19.0.0-rc-28fe581bac-20240531"
});
exports._Scheduler = Scheduler;
exports.act = act;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<7c8b2fbd40f4e2eb7cd331073ef4c27b>>
* @generated SignedSource<<157f443607888a05b53d9d23d8a2d840>>
*/

'use strict';
Expand All @@ -24,7 +24,7 @@ if (
}
var dynamicFlagsUntyped = require('ReactNativeInternalFeatureFlags');

var ReactVersion = '19.0.0-rc-8bc81ca90f-20240531';
var ReactVersion = '19.0.0-rc-28fe581bac-20240531';

// Re-export dynamic flags from the internal module.
var dynamicFlags = dynamicFlagsUntyped; // We destructure each value before re-exporting to avoid a dynamic look-up on
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<3381778c736b28c1edc21ecca003f7e3>>
* @generated SignedSource<<f604af31fab5d9ed18da2f9bc1623c9f>>
*/

"use strict";
Expand Down Expand Up @@ -604,4 +604,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-rc-8bc81ca90f-20240531";
exports.version = "19.0.0-rc-28fe581bac-20240531";
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<a4506c6d0c22b34564c61f2c18c2e6f5>>
* @generated SignedSource<<82497046cf2b0f32f7d52ceb09a02386>>
*/

"use strict";
Expand Down Expand Up @@ -608,7 +608,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactSharedInternals.H.useTransition();
};
exports.version = "19.0.0-rc-8bc81ca90f-20240531";
exports.version = "19.0.0-rc-28fe581bac-20240531";
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
"function" ===
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8bc81ca90fb0afb3fe4a28d8931733a3e6fef994
28fe581bac10ca91b0d12d95beb034cfe790f3d0
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<a37aacace6e897d96caf734b210c1cc8>>
* @generated SignedSource<<7af656b7f088d3769616934b1b2e642b>>
*/

'use strict';
Expand Down Expand Up @@ -26206,7 +26206,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-rc-8bc81ca90f-20240531';
var ReactVersion = '19.0.0-rc-28fe581bac-20240531';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<325d37b8cba573f782fefff26ef57fd1>>
* @generated SignedSource<<8ede2fc599f1edc4462dade6134f7392>>
*/

"use strict";
Expand Down Expand Up @@ -10551,7 +10551,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1124 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "19.0.0-rc-8bc81ca90f-20240531",
version: "19.0.0-rc-28fe581bac-20240531",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down Expand Up @@ -10594,7 +10594,7 @@ var internals$jscomp$inline_1350 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-8bc81ca90f-20240531"
reconcilerVersion: "19.0.0-rc-28fe581bac-20240531"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1351 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<83cd462bf9a383c065072ed7d861c363>>
* @generated SignedSource<<972ed4c454ec9065518dc9ab2a94dc5c>>
*/

"use strict";
Expand Down Expand Up @@ -11257,7 +11257,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1205 = {
findFiberByHostInstance: getInstanceFromNode,
bundleType: 0,
version: "19.0.0-rc-8bc81ca90f-20240531",
version: "19.0.0-rc-28fe581bac-20240531",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down Expand Up @@ -11313,7 +11313,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-8bc81ca90f-20240531"
reconcilerVersion: "19.0.0-rc-28fe581bac-20240531"
});
exports.createPortal = function (children, containerTag) {
return createPortal$1(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<30c3d2bf06f8fd8c71a171100add2662>>
* @generated SignedSource<<b4e8bb30431a24d682d1d4ae6e483add>>
*/

'use strict';
Expand Down Expand Up @@ -26562,7 +26562,7 @@ identifierPrefix, onUncaughtError, onCaughtError, onRecoverableError, transition
return root;
}

var ReactVersion = '19.0.0-rc-8bc81ca90f-20240531';
var ReactVersion = '19.0.0-rc-28fe581bac-20240531';

/*
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<2958431ba302eef1d96132430864ee1a>>
* @generated SignedSource<<e30a753954f25dc5c732535c005dae86>>
*/

"use strict";
Expand Down Expand Up @@ -10696,11 +10696,11 @@ function traverseOwnerTreeUp(hierarchy, instance) {
traverseOwnerTreeUp(hierarchy, instance);
}
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-rc-8bc81ca90f-20240531" !== isomorphicReactPackageVersion)
if ("19.0.0-rc-28fe581bac-20240531" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.0.0-rc-8bc81ca90f-20240531\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.0.0-rc-28fe581bac-20240531\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
Expand Down Expand Up @@ -10750,7 +10750,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1192 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "19.0.0-rc-8bc81ca90f-20240531",
version: "19.0.0-rc-28fe581bac-20240531",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down Expand Up @@ -10793,7 +10793,7 @@ var internals$jscomp$inline_1439 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-8bc81ca90f-20240531"
reconcilerVersion: "19.0.0-rc-28fe581bac-20240531"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1440 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* @noflow
* @nolint
* @preventMunge
* @generated SignedSource<<12cc518fa06adc483d79f48e3bf0a1be>>
* @generated SignedSource<<649260d0b4acd3f5bcd00ec118168a30>>
*/

"use strict";
Expand Down Expand Up @@ -11403,11 +11403,11 @@ function traverseOwnerTreeUp(hierarchy, instance) {
traverseOwnerTreeUp(hierarchy, instance);
}
var isomorphicReactPackageVersion = React.version;
if ("19.0.0-rc-8bc81ca90f-20240531" !== isomorphicReactPackageVersion)
if ("19.0.0-rc-28fe581bac-20240531" !== isomorphicReactPackageVersion)
throw Error(
'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n - react: ' +
(isomorphicReactPackageVersion +
"\n - react-native-renderer: 19.0.0-rc-8bc81ca90f-20240531\nLearn more: https://react.dev/warnings/version-mismatch")
"\n - react-native-renderer: 19.0.0-rc-28fe581bac-20240531\nLearn more: https://react.dev/warnings/version-mismatch")
);
if (
"function" !==
Expand Down Expand Up @@ -11457,7 +11457,7 @@ var roots = new Map(),
devToolsConfig$jscomp$inline_1273 = {
findFiberByHostInstance: getInstanceFromTag,
bundleType: 0,
version: "19.0.0-rc-8bc81ca90f-20240531",
version: "19.0.0-rc-28fe581bac-20240531",
rendererPackageName: "react-native-renderer",
rendererConfig: {
getInspectorDataForInstance: getInspectorDataForInstance,
Expand Down Expand Up @@ -11513,7 +11513,7 @@ var roots = new Map(),
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "19.0.0-rc-8bc81ca90f-20240531"
reconcilerVersion: "19.0.0-rc-28fe581bac-20240531"
});
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
computeComponentStackForErrorReporting: function (reactTag) {
Expand Down

0 comments on commit d0d9492

Please sign in to comment.