Skip to content

Commit d0ef740

Browse files
Brian Vaughnrickhanlonii
Brian Vaughn
authored andcommitted
Profiler should only report stateful hooks that change between renders (#24189)
The Profiler has an advanced feature that shows why a component re-rendered. In the case of props and (class) state, it shows the names of props/state values that changed between renders. For hooks, DevTools tries to detect which ones may been related to the update by comparing prev/next internal hook structures. My initial implementation tried to detect all changed hooks. In hindsight this is confusing, because only stateful hooks (e.g. useState, useReducer, and useSyncExternalStore) can schedule an update. (Other types of hooks can change between renders, but in a reactive way.) This PR changes the behavior to only report hooks that scheduled the update.
1 parent 724d499 commit d0ef740

File tree

3 files changed

+523
-442
lines changed

3 files changed

+523
-442
lines changed

0 commit comments

Comments
 (0)