Brian Vaughn

Results 415 comments of Brian Vaughn

I think that specifying some other global boolean (that DevTools and React both could read and respect) feels less fragile than encouraging people to override the hook. In general, I'm...

Thanks for the bug report and concise repo. I'll take a look this morning.

I can reproduce this failure in a unit test btw: ```js it('should gracefully handle custom hooks that have the same name as primitive hooks', async done => { let inspectedElement...

Seems like (maybe among other things) this check is not great: https://github.com/facebook/react/blob/master/packages/react-debug-tools/src/ReactDebugHooks.js#L538-L539

> @bvaughn in your smaller version, I don't think you need the useEffect You do, if you want to repro the runtime error. Without it, the error isn't thrown (although...

I think the core of this problem is here: https://github.com/facebook/react/blob/a511dc7090523ee49ce21a08e55c41917d8af311/packages/react-debug-tools/src/ReactDebugHooks.js#L439-L444 This check in `findPrimitiveIndex` is what causes the "primitive index" to advance too far if a custom hook name matches...

I need to sit this task down for now because I have something more pressing to work on. If anyone else feels like picking it up, that would be great....

Note that I think we could prevent the runtime error by adding a check before pushing to `levelChildren`: ```js if (levelChildren !== undefined) { levelChildren.push({ id, isStateEditable, name: primitive, value:...

That's not the way custom hook support is supposed to work in DevTools, and I don't think it would be what you wanted anyway (e.g. Effect hook would be invisible...

It just happens to be the effect hook because of the way this example code is structured. It could be other arbitrary hooks that were shown or hidden if the...