Skip to content

Reduce react-devtools-custom overhead by deferring hook inspection#1

Merged
mdm317 merged 11 commits into
devtools-customfrom
devtools-custom-performance
Apr 20, 2026
Merged

Reduce react-devtools-custom overhead by deferring hook inspection#1
mdm317 merged 11 commits into
devtools-customfrom
devtools-custom-performance

Conversation

@mdm317
Copy link
Copy Markdown
Owner

@mdm317 mdm317 commented Apr 20, 2026

Issue

inspectHooksOfFiber is too expensive for this use case. On frequently updating components, it can become slow enough to freeze the browser.

Approach

Revert hook change detection to the pre-facebook#35123 behavior. Then defer parsing hook metadata, such as hook names, until after the commit completes, and add caching so hook inspection runs at most once per fiber whenever possible.

Limitations

For now, special handling is only implemented for:

  • SyncExternalStore
  • Transition
  • ActionState
  • FormState

Testing

  • yarn test --project devtools --build packages/react-devtools-custom/src/__tests__/profilingCache-test.js --runInBand

@mdm317 mdm317 merged commit b712644 into devtools-custom Apr 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant