diff --git a/packages/react-debug-tools/src/ReactDebugHooks.js b/packages/react-debug-tools/src/ReactDebugHooks.js index 20e3d89e1bf64..8e1809435d724 100644 --- a/packages/react-debug-tools/src/ReactDebugHooks.js +++ b/packages/react-debug-tools/src/ReactDebugHooks.js @@ -444,14 +444,15 @@ function useTransition(): [ function useDeferredValue(value: T, initialValue?: T): T { const hook = nextHook(); + const prevValue = hook !== null ? hook.memoizedState : value; hookLog.push({ displayName: null, primitive: 'DeferredValue', stackError: new Error(), - value: hook !== null ? hook.memoizedState : value, + value: prevValue, debugInfo: null, }); - return value; + return prevValue; } function useId(): string { diff --git a/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js b/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js index e741a84063d43..61eefa844aece 100644 --- a/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js +++ b/packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.js @@ -1348,6 +1348,20 @@ describe('ReactHooksInspectionIntegration', () => { "subHooks": [], "value": false, }, + { + "debugInfo": null, + "hookSource": { + "columnNumber": 0, + "fileName": "**", + "functionName": "Foo", + "lineNumber": 0, + }, + "id": null, + "isStateEditable": false, + "name": "Context", + "subHooks": [], + "value": "provided", + }, { "debugInfo": null, "hookSource": {