From a98a1331207934a6602bf471399d3a1ca6df4b72 Mon Sep 17 00:00:00 2001 From: James Vaughan Date: Tue, 20 Feb 2024 09:16:36 -0800 Subject: [PATCH 1/2] Add useSyncExternalStore and useTransition to getPrimitiveStackCache --- packages/react-debug-tools/src/ReactDebugHooks.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/react-debug-tools/src/ReactDebugHooks.js b/packages/react-debug-tools/src/ReactDebugHooks.js index e6a85b86a89d4..1b285b562e19c 100644 --- a/packages/react-debug-tools/src/ReactDebugHooks.js +++ b/packages/react-debug-tools/src/ReactDebugHooks.js @@ -82,6 +82,13 @@ function getPrimitiveStackCache(): Map> { Dispatcher.useImperativeHandle(undefined, () => null); Dispatcher.useDebugValue(null); Dispatcher.useCallback(() => {}); + Dispatcher.useTransition(); + Dispatcher.useSyncExternalStore( + () => () => {}, + () => null, + () => null, + ); + Dispatcher.useDeferredValue(null); Dispatcher.useMemo(() => null); if (typeof Dispatcher.useMemoCache === 'function') { // This type check is for Flow only. From d712e724891a296a083f88e185305defbdff5deb Mon Sep 17 00:00:00 2001 From: James Vaughan Date: Tue, 20 Feb 2024 15:35:01 -0800 Subject: [PATCH 2/2] Update ReactHooksInspectionIntegration tests --- .../src/__tests__/ReactHooksInspectionIntegration-test.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js b/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js index a74bbe9ca2817..1fc54ef0f9102 100644 --- a/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js +++ b/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js @@ -928,7 +928,7 @@ describe('ReactHooksInspectionIntegration', () => { "hookSource": { "columnNumber": 0, "fileName": "**", - "functionName": null, + "functionName": "Foo", "lineNumber": 0, }, "id": 0, @@ -986,7 +986,7 @@ describe('ReactHooksInspectionIntegration', () => { "hookSource": { "columnNumber": 0, "fileName": "**", - "functionName": null, + "functionName": "Foo", "lineNumber": 0, }, "id": 0, @@ -1969,7 +1969,7 @@ describe('ReactHooksInspectionIntegration', () => { "hookSource": { "columnNumber": 0, "fileName": "**", - "functionName": null, + "functionName": "Foo", "lineNumber": 0, }, "id": 0,