Commit b4ab87e
committed
fix[devtools/useTransition]: don't check for dispatch property when determining if hook is stateful (#27365)
#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 56b1447.1 parent e1f7f22 commit b4ab87e
File tree
7 files changed
+9
-9
lines changed- compiled-rn/facebook-fbsource/xplat/js
- RKJSModules/vendor
- react-test-renderer/cjs
- react/cjs
- react-native-github/Libraries/Renderer
7 files changed
+9
-9
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23998 | 23998 | | |
23999 | 23999 | | |
24000 | 24000 | | |
24001 | | - | |
| 24001 | + | |
24002 | 24002 | | |
24003 | 24003 | | |
24004 | 24004 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8620 | 8620 | | |
8621 | 8621 | | |
8622 | 8622 | | |
8623 | | - | |
| 8623 | + | |
8624 | 8624 | | |
8625 | 8625 | | |
8626 | 8626 | | |
| |||
8651 | 8651 | | |
8652 | 8652 | | |
8653 | 8653 | | |
8654 | | - | |
| 8654 | + | |
8655 | 8655 | | |
8656 | 8656 | | |
8657 | 8657 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9046 | 9046 | | |
9047 | 9047 | | |
9048 | 9048 | | |
9049 | | - | |
| 9049 | + | |
9050 | 9050 | | |
9051 | 9051 | | |
9052 | 9052 | | |
| |||
9077 | 9077 | | |
9078 | 9078 | | |
9079 | 9079 | | |
9080 | | - | |
| 9080 | + | |
9081 | 9081 | | |
9082 | 9082 | | |
9083 | 9083 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
616 | 616 | | |
617 | 617 | | |
618 | 618 | | |
619 | | - | |
| 619 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
622 | | - | |
| 622 | + | |
623 | 623 | | |
624 | 624 | | |
625 | 625 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
0 commit comments