Skip to content

Commit 363b626

Browse files
committed
Improve flagging of React.cache to remove indirection in bundled code (#28263)
Uses a better technique for conditionally disabling cache on the client DiffTrain build for commit a1ace9d.
1 parent fcad637 commit 363b626

File tree

7 files changed

+28
-29
lines changed

7 files changed

+28
-29
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
@@ -25725,7 +25725,7 @@ if (__DEV__) {
2572525725
return root;
2572625726
}
2572725727

25728-
var ReactVersion = "18.3.0-canary-91caa96e4-20240206";
25728+
var ReactVersion = "18.3.0-canary-a1ace9d3c-20240206";
2572925729

2573025730
// Might add PROFILE later.
2573125731

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
@@ -9157,7 +9157,7 @@ var devToolsConfig$jscomp$inline_1012 = {
91579157
throw Error("TestRenderer does not support findFiberByHostInstance()");
91589158
},
91599159
bundleType: 0,
9160-
version: "18.3.0-canary-91caa96e4-20240206",
9160+
version: "18.3.0-canary-a1ace9d3c-20240206",
91619161
rendererPackageName: "react-test-renderer"
91629162
};
91639163
var internals$jscomp$inline_1190 = {
@@ -9188,7 +9188,7 @@ var internals$jscomp$inline_1190 = {
91889188
scheduleRoot: null,
91899189
setRefreshHandler: null,
91909190
getCurrentFiber: null,
9191-
reconcilerVersion: "18.3.0-canary-91caa96e4-20240206"
9191+
reconcilerVersion: "18.3.0-canary-a1ace9d3c-20240206"
91929192
};
91939193
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
91949194
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
@@ -9585,7 +9585,7 @@ var devToolsConfig$jscomp$inline_1054 = {
95859585
throw Error("TestRenderer does not support findFiberByHostInstance()");
95869586
},
95879587
bundleType: 0,
9588-
version: "18.3.0-canary-91caa96e4-20240206",
9588+
version: "18.3.0-canary-a1ace9d3c-20240206",
95899589
rendererPackageName: "react-test-renderer"
95909590
};
95919591
var internals$jscomp$inline_1231 = {
@@ -9616,7 +9616,7 @@ var internals$jscomp$inline_1231 = {
96169616
scheduleRoot: null,
96179617
setRefreshHandler: null,
96189618
getCurrentFiber: null,
9619-
reconcilerVersion: "18.3.0-canary-91caa96e4-20240206"
9619+
reconcilerVersion: "18.3.0-canary-a1ace9d3c-20240206"
96209620
};
96219621
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
96229622
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 & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* @noflow
88
* @nolint
99
* @preventMunge
10-
* @generated SignedSource<<41ebcac0959dc7c1f568b21dae3e2874>>
10+
* @generated SignedSource<<e586d9c47ab7cba6a52560196c89aa09>>
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-91caa96e4-20240206";
27+
var ReactVersion = "18.3.0-canary-a1ace9d3c-20240206";
2828

2929
// ATTENTION
3030
// When adding new symbols to this file,
@@ -2735,26 +2735,25 @@ if (__DEV__) {
27352735
return elementType;
27362736
}
27372737

2738-
function cache(fn) {
2739-
{
2740-
// On the client (i.e. not a Server Components environment) `cache` has
2741-
// no caching behavior. We just return the function as-is.
2742-
//
2743-
// We intend to implement client caching in a future major release. In the
2744-
// meantime, it's only exposed as an API so that Shared Components can use
2745-
// per-request caching on the server without breaking on the client. But it
2746-
// does mean they need to be aware of the behavioral difference.
2747-
//
2748-
// The rest of the behavior is the same as the server implementation — it
2749-
// returns a new reference, extra properties like `displayName` are not
2750-
// preserved, the length of the new function is 0, etc. That way apps can't
2751-
// accidentally depend on those details.
2752-
return function () {
2753-
// $FlowFixMe[incompatible-call]: We don't want to use rest arguments since we transpile the code.
2754-
return fn.apply(null, arguments);
2755-
};
2756-
}
2738+
function noopCache(fn) {
2739+
// On the client (i.e. not a Server Components environment) `cache` has
2740+
// no caching behavior. We just return the function as-is.
2741+
//
2742+
// We intend to implement client caching in a future major release. In the
2743+
// meantime, it's only exposed as an API so that Shared Components can use
2744+
// per-request caching on the server without breaking on the client. But it
2745+
// does mean they need to be aware of the behavioral difference.
2746+
//
2747+
// The rest of the behavior is the same as the server implementation — it
2748+
// returns a new reference, extra properties like `displayName` are not
2749+
// preserved, the length of the new function is 0, etc. That way apps can't
2750+
// accidentally depend on those details.
2751+
return function () {
2752+
// $FlowFixMe[incompatible-call]: We don't want to use rest arguments since we transpile the code.
2753+
return fn.apply(null, arguments);
2754+
};
27572755
}
2756+
var cache = noopCache;
27582757

27592758
function resolveDispatcher() {
27602759
var dispatcher = ReactCurrentDispatcher.current;

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
@@ -548,4 +548,4 @@ exports.useSyncExternalStore = function (
548548
exports.useTransition = function () {
549549
return ReactCurrentDispatcher.current.useTransition();
550550
};
551-
exports.version = "18.3.0-canary-91caa96e4-20240206";
551+
exports.version = "18.3.0-canary-a1ace9d3c-20240206";

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
@@ -544,7 +544,7 @@ exports.useSyncExternalStore = function (
544544
exports.useTransition = function () {
545545
return ReactCurrentDispatcher.current.useTransition();
546546
};
547-
exports.version = "18.3.0-canary-91caa96e4-20240206";
547+
exports.version = "18.3.0-canary-a1ace9d3c-20240206";
548548
"undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&
549549
"function" ===
550550
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
91caa96e4261704d42333f5e02ba32d870379fc4
1+
a1ace9d3c2a0fc53703f11e30f32d0a009c5a8c9

0 commit comments

Comments
 (0)