Skip to content

Commit

Permalink
fix[devtools/useMemoCache]: add stub for useMemoCache in ReactDebugHo…
Browse files Browse the repository at this point in the history
…ok (#27472)

Currently, we have this error in our logs of the internal version of
React DevTools:
```
TypeError: Cannot read properties of undefined (reading 'memoCache')
    at Proxy.useMemoCache (chrome-extension://dnjnjgbfilfphmojnmhliehogmojhclc/build/react_devtools_backend_compact.js:151:71)
```

Looking at the build files of the extension, it fails here:
https://github.com/facebook/react/blob/dddfe688206dafa5646550d351eb9a8e9c53654a/packages/react-debug-tools/src/ReactDebugHooks.js#L333-L337

Looks like `updateQueue` can be `undefined`, as it is not defined in
hook object here:
https://github.com/facebook/react/blob/dddfe688206dafa5646550d351eb9a8e9c53654a/packages/react-reconciler/src/ReactFiberHooks.js#L180-L186

~~Also, it looks like `useMemoCache` implementation doesn't expect this,
so it should also result into TypeError here, line 1114:~~

https://github.com/facebook/react/blob/dddfe688206dafa5646550d351eb9a8e9c53654a/packages/react-reconciler/src/ReactFiberHooks.js#L1108-L1115

~~Should this also be updated?~~

DiffTrain build for commit a419575.
  • Loading branch information
hoxyq committed Oct 17, 2023
1 parent 8d3e7a7 commit 7d58742
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24878,7 +24878,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-canary-75c1bd7ee-20231017";
var ReactVersion = "18.3.0-canary-a41957507-20231017";

// Might add PROFILE later.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9022,7 +9022,7 @@ var devToolsConfig$jscomp$inline_1031 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-75c1bd7ee-20231017",
version: "18.3.0-canary-a41957507-20231017",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1224 = {
Expand Down Expand Up @@ -9053,7 +9053,7 @@ var internals$jscomp$inline_1224 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-75c1bd7ee-20231017"
reconcilerVersion: "18.3.0-canary-a41957507-20231017"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1225 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9448,7 +9448,7 @@ var devToolsConfig$jscomp$inline_1073 = {
throw Error("TestRenderer does not support findFiberByHostInstance()");
},
bundleType: 0,
version: "18.3.0-canary-75c1bd7ee-20231017",
version: "18.3.0-canary-a41957507-20231017",
rendererPackageName: "react-test-renderer"
};
var internals$jscomp$inline_1265 = {
Expand Down Expand Up @@ -9479,7 +9479,7 @@ var internals$jscomp$inline_1265 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-canary-75c1bd7ee-20231017"
reconcilerVersion: "18.3.0-canary-a41957507-20231017"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1266 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-canary-75c1bd7ee-20231017";
var ReactVersion = "18.3.0-canary-a41957507-20231017";

// ATTENTION
// When adding new symbols to this file,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,4 +580,4 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-75c1bd7ee-20231017";
exports.version = "18.3.0-canary-a41957507-20231017";
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ exports.useSyncExternalStore = function (
exports.useTransition = function () {
return ReactCurrentDispatcher.current.useTransition();
};
exports.version = "18.3.0-canary-75c1bd7ee-20231017";
exports.version = "18.3.0-canary-a41957507-20231017";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
75c1bd7ee7e4a87a4dd0f560e157c57957ef823b
a4195750779dbd9a13e1615fbbd493bf2c5768ca

0 comments on commit 7d58742

Please sign in to comment.