Skip to content

Commit

Permalink
Profiler should only report stateful hooks that change between renders (
Browse files Browse the repository at this point in the history
#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.
  • Loading branch information
Brian Vaughn authored and rickhanlonii committed Apr 14, 2022
1 parent 3b88db0 commit b1f7764
Show file tree
Hide file tree
Showing 3 changed files with 523 additions and 442 deletions.

0 comments on commit b1f7764

Please sign in to comment.