Skip to content

Commit 3d453eb

Browse files
committed
Add flag to disable caching behavior of React.cache on the client (#28250)
Adds a feature flag to control whether the client cache function is just a passthrough. before we land breaking changes for the next major it will be off and then we can flag it on when we want to break it. flag is off for OSS for now and on elsewhere (though the parent flag enableCache is off in some cases) DiffTrain build for commit 2bc7d33.
1 parent affeba5 commit 3d453eb

File tree

7 files changed

+28
-26
lines changed

7 files changed

+28
-26
lines changed

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-dev.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25600,7 +25600,7 @@ if (__DEV__) {
2560025600
return root;
2560125601
}
2560225602

25603-
var ReactVersion = "18.3.0-canary-472854820-20240205";
25603+
var ReactVersion = "18.3.0-canary-2bc7d336a-20240205";
2560425604

2560525605
// Might add PROFILE later.
2560625606

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-prod.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9150,7 +9150,7 @@ var devToolsConfig$jscomp$inline_1012 = {
91509150
throw Error("TestRenderer does not support findFiberByHostInstance()");
91519151
},
91529152
bundleType: 0,
9153-
version: "18.3.0-canary-472854820-20240205",
9153+
version: "18.3.0-canary-2bc7d336a-20240205",
91549154
rendererPackageName: "react-test-renderer"
91559155
};
91569156
var internals$jscomp$inline_1190 = {
@@ -9181,7 +9181,7 @@ var internals$jscomp$inline_1190 = {
91819181
scheduleRoot: null,
91829182
setRefreshHandler: null,
91839183
getCurrentFiber: null,
9184-
reconcilerVersion: "18.3.0-canary-472854820-20240205"
9184+
reconcilerVersion: "18.3.0-canary-2bc7d336a-20240205"
91859185
};
91869186
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
91879187
var hook$jscomp$inline_1191 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

compiled-rn/facebook-fbsource/xplat/js/RKJSModules/vendor/react-test-renderer/cjs/ReactTestRenderer-profiling.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9578,7 +9578,7 @@ var devToolsConfig$jscomp$inline_1054 = {
95789578
throw Error("TestRenderer does not support findFiberByHostInstance()");
95799579
},
95809580
bundleType: 0,
9581-
version: "18.3.0-canary-472854820-20240205",
9581+
version: "18.3.0-canary-2bc7d336a-20240205",
95829582
rendererPackageName: "react-test-renderer"
95839583
};
95849584
var internals$jscomp$inline_1231 = {
@@ -9609,7 +9609,7 @@ var internals$jscomp$inline_1231 = {
96099609
scheduleRoot: null,
96109610
setRefreshHandler: null,
96119611
getCurrentFiber: null,
9612-
reconcilerVersion: "18.3.0-canary-472854820-20240205"
9612+
reconcilerVersion: "18.3.0-canary-2bc7d336a-20240205"
96139613
};
96149614
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
96159615
var hook$jscomp$inline_1232 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

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

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<b457d955ef3e9a1d11099969695e702a>>
10+
* @generated SignedSource<<36da4235b8cea50c15718bbeb276e9c8>>
1111
*/
1212

1313
"use strict";
@@ -24,7 +24,7 @@ if (__DEV__) {
2424
) {
2525
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
2626
}
27-
var ReactVersion = "18.3.0-canary-472854820-20240205";
27+
var ReactVersion = "18.3.0-canary-2bc7d336a-20240205";
2828

2929
// ATTENTION
3030
// When adding new symbols to this file,
@@ -2450,22 +2450,24 @@ if (__DEV__) {
24502450
}
24512451

24522452
function cache(fn) {
2453-
// On the client (i.e. not a Server Components environment) `cache` has
2454-
// no caching behavior. We just return the function as-is.
2455-
//
2456-
// We intend to implement client caching in a future major release. In the
2457-
// meantime, it's only exposed as an API so that Shared Components can use
2458-
// per-request caching on the server without breaking on the client. But it
2459-
// does mean they need to be aware of the behavioral difference.
2460-
//
2461-
// The rest of the behavior is the same as the server implementation — it
2462-
// returns a new reference, extra properties like `displayName` are not
2463-
// preserved, the length of the new function is 0, etc. That way apps can't
2464-
// accidentally depend on those details.
2465-
return function () {
2466-
// $FlowFixMe[incompatible-call]: We don't want to use rest arguments since we transpile the code.
2467-
return fn.apply(null, arguments);
2468-
};
2453+
{
2454+
// On the client (i.e. not a Server Components environment) `cache` has
2455+
// no caching behavior. We just return the function as-is.
2456+
//
2457+
// We intend to implement client caching in a future major release. In the
2458+
// meantime, it's only exposed as an API so that Shared Components can use
2459+
// per-request caching on the server without breaking on the client. But it
2460+
// does mean they need to be aware of the behavioral difference.
2461+
//
2462+
// The rest of the behavior is the same as the server implementation — it
2463+
// returns a new reference, extra properties like `displayName` are not
2464+
// preserved, the length of the new function is 0, etc. That way apps can't
2465+
// accidentally depend on those details.
2466+
return function () {
2467+
// $FlowFixMe[incompatible-call]: We don't want to use rest arguments since we transpile the code.
2468+
return fn.apply(null, arguments);
2469+
};
2470+
}
24692471
}
24702472

24712473
function resolveDispatcher() {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,4 +543,4 @@ exports.useSyncExternalStore = function (
543543
exports.useTransition = function () {
544544
return ReactCurrentDispatcher.current.useTransition();
545545
};
546-
exports.version = "18.3.0-canary-472854820-20240205";
546+
exports.version = "18.3.0-canary-2bc7d336a-20240205";

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ exports.useSyncExternalStore = function (
539539
exports.useTransition = function () {
540540
return ReactCurrentDispatcher.current.useTransition();
541541
};
542-
exports.version = "18.3.0-canary-472854820-20240205";
542+
exports.version = "18.3.0-canary-2bc7d336a-20240205";
543543
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
544544
"function" ===
545545
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
472854820bfd0058dfc85524051171c7b7c998c1
1+
2bc7d336ae7db689699baeb1fffc2c03d8753ffe

0 commit comments

Comments
 (0)