Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
[DevTools] fix useDeferredValue to match reconciler change
  • Loading branch information
mondaychen committed Jun 16, 2022
commit 7daa703ba75f4d2a24240447f6afa7e34117b3c1
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