dillon1000/react

Commit

Add Debug Tools Package for Introspection of Hooks (#14085)

* Add debug tools package

* Add basic implementation

* Implement inspection of the current state of hooks using the fiber tree

* Support useContext hooks inspection by backtracking from the Fiber

I'm not sure this is safe because the return fibers may not be current
but close enough and it's fast.

We use this to set up the current values of the providers.

* rm copypasta

* Use lastIndexOf

Just in case. I don't know of any scenario where this can happen.

* Support ForwardRef

* Add test for memo and custom hooks

* Support defaultProps resolution
Browse files
Changed paths14 files
First-parent comparison
M package.json ModifiedA packages/react-debug-tools/README.md AddedA packages/react-debug-tools/index.js AddedA packages/react-debug-tools/npm/index.js AddedA packages/react-debug-tools/package.json AddedA packages/react-debug-tools/src/ReactDebugHooks.js AddedA packages/react-debug-tools/src/ReactDebugTools.js AddedA packages/react-debug-tools/src/__tests__/ReactHooksInspection-test.internal.js AddedA packages/react-debug-tools/src/__tests__/ReactHooksInspectionIntegration-test.internal.js AddedM packages/react-reconciler/src/ReactFiberHooks.js ModifiedM packages/react-test-renderer/src/ReactTestRenderer.js ModifiedM scripts/rollup/bundles.js ModifiedM scripts/rollup/results.json ModifiedM yarn.lock Modified
Patch

Files changed

Rendering syntax-highlighted changes…