Skip to content

Commit

Permalink
[DevTools] fix useDeferredValue to match reconciler change
Browse files Browse the repository at this point in the history
  • Loading branch information
mondaychen committed Jun 16, 2022
1 parent 522f473 commit 73bd191
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/react-debug-tools/src/ReactDebugHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,11 @@ function useTransition(): [
}

function useDeferredValue<T>(value: T): T {
// useDeferredValue() composes multiple hooks internally.
// Advance the current hook index the same number of times
// so that subsequent hooks have the right memoized state.
nextHook(); // State
nextHook(); // Effect
const hook = nextHook();
hookLog.push({
primitive: 'DeferredValue',
stackError: new Error(),
value,
value: hook !== null ? hook.memoizedState[0] : value,
});
return value;
}
Expand Down

0 comments on commit 73bd191

Please sign in to comment.