bvaughn / react-devtools-experimental

Experimental rewrite of the React DevTools extension
https://react-devtools-experimental.now.sh
MIT License
965 stars 55 forks source link

Hook label is sometimes empty #328

Closed gaearon closed 5 years ago

gaearon commented 5 years ago
Screen Shot 2019-06-18 at 5 40 21 PM

Seeing this in FB5TopNavBar.

bvaughn commented 5 years ago

It looks like the source code in this example has a "custom hook" that's assigned to a variable (e.g. useFoo) but is being created by a helper function (which returns an anonymous function, so there's no actual name being associated with the hook). So that's the first problem.

A second related problem is that FB's lazy/inline requires are resulting in this function being named e.g. "__annotator.module" in DEV (and empty string in prod).

Looks like we've created a new thing, the "Higher order Hook" 😭

bvaughn commented 5 years ago

Screen Shot 2019-06-18 at 11 36 46 AM

DevTools will, for now, just display these as dimmed "Anonymous"

Fixed in abc8ef3, deploying now.