Skip to content

Commit b4ab87e

Browse files
committed
fix[devtools/useTransition]: don't check for dispatch property when determining if hook is stateful (#27365)
facebook/react#26740 introduced regression: React DevTools doesn't record updates for `useTransition` hook. I can add more details about things on DevTools side, if needed. The root cause is https://github.com/facebook/react/blob/491aec5d6113ce5bae7c10966bc38a4a8fc091a8/packages/react-reconciler/src/ReactFiberHooks.js#L2728-L2730 React DevTools expects dispatch to be present for stateful hooks that can schedule an update - https://github.com/facebook/react/blob/2eed1328478e8c923fcb4e6abf5efbd9e1233402/packages/react-devtools-shared/src/backend/renderer.js#L1422-L1428 With these changes, we still call dispatch in `startTransition`, but also patch `queue` object with it, so that React DevTools can recognise `useTransition` as stateful hook that can schedule update. I am not sure if this is the right approach to fix this, can we distinguish if `startTransition` was called from `useTransition` hook or as a standalone function? DiffTrain build for commit facebook/react@56b1447.
1 parent e1f7f22 commit b4ab87e

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
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
@@ -23998,7 +23998,7 @@ function createFiberRoot(
2399823998
return root;
2399923999
}
2400024000

24001-
var ReactVersion = "18.3.0-canary-68ac6dbcf-20230921";
24001+
var ReactVersion = "18.3.0-canary-56b14477e-20230921";
2400224002

2400324003
// Might add PROFILE later.
2400424004

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
@@ -8620,7 +8620,7 @@ var devToolsConfig$jscomp$inline_1028 = {
86208620
throw Error("TestRenderer does not support findFiberByHostInstance()");
86218621
},
86228622
bundleType: 0,
8623-
version: "18.3.0-canary-68ac6dbcf-20230921",
8623+
version: "18.3.0-canary-56b14477e-20230921",
86248624
rendererPackageName: "react-test-renderer"
86258625
};
86268626
var internals$jscomp$inline_1227 = {
@@ -8651,7 +8651,7 @@ var internals$jscomp$inline_1227 = {
86518651
scheduleRoot: null,
86528652
setRefreshHandler: null,
86538653
getCurrentFiber: null,
8654-
reconcilerVersion: "18.3.0-canary-68ac6dbcf-20230921"
8654+
reconcilerVersion: "18.3.0-canary-56b14477e-20230921"
86558655
};
86568656
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
86578657
var hook$jscomp$inline_1228 = __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
@@ -9046,7 +9046,7 @@ var devToolsConfig$jscomp$inline_1070 = {
90469046
throw Error("TestRenderer does not support findFiberByHostInstance()");
90479047
},
90489048
bundleType: 0,
9049-
version: "18.3.0-canary-68ac6dbcf-20230921",
9049+
version: "18.3.0-canary-56b14477e-20230921",
90509050
rendererPackageName: "react-test-renderer"
90519051
};
90529052
var internals$jscomp$inline_1268 = {
@@ -9077,7 +9077,7 @@ var internals$jscomp$inline_1268 = {
90779077
scheduleRoot: null,
90789078
setRefreshHandler: null,
90799079
getCurrentFiber: null,
9080-
reconcilerVersion: "18.3.0-canary-68ac6dbcf-20230921"
9080+
reconcilerVersion: "18.3.0-canary-56b14477e-20230921"
90819081
};
90829082
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
90839083
var hook$jscomp$inline_1269 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ if (
2727
}
2828
"use strict";
2929

30-
var ReactVersion = "18.3.0-canary-68ac6dbcf-20230921";
30+
var ReactVersion = "18.3.0-canary-56b14477e-20230921";
3131

3232
// ATTENTION
3333
// When adding new symbols to this file,

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
@@ -616,4 +616,4 @@ exports.useSyncExternalStore = function (
616616
exports.useTransition = function () {
617617
return ReactCurrentDispatcher.current.useTransition();
618618
};
619-
exports.version = "18.3.0-canary-68ac6dbcf-20230921";
619+
exports.version = "18.3.0-canary-56b14477e-20230921";

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
@@ -619,7 +619,7 @@ exports.useSyncExternalStore = function (
619619
exports.useTransition = function () {
620620
return ReactCurrentDispatcher.current.useTransition();
621621
};
622-
exports.version = "18.3.0-canary-68ac6dbcf-20230921";
622+
exports.version = "18.3.0-canary-56b14477e-20230921";
623623

624624
/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
625625
if (
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
68ac6dbcf8d58a67e94e9061395dd96a52d92377
1+
56b14477e902ac076018be2e7bf2ea3092ac9e7d

0 commit comments

Comments
 (0)