bvaughn/react-devtools-experimental

feat: support search by prop, state, hooks

AndersDJohnson opened this issue · 1 comments

Support searching for components by the name (and possibly also value) of a prop, local class component state, and possibly even hook-derived variables (perhaps via useDebugValue or some means to capture labels such as Babel plugin).

Realistically, I don't think this feature is worth the complexity required to support it.

Searching prop/state/hook name and value would make results very noisy which would harm the most common use case (search by name). To offset this, we would need to add more complex search controls which enabled you to choose which criteria you wanted to search by. (An inline search box would no longer be enough.)

It would also require moving all of search to the backend thread, since the frontend does not have props/state/hooks information, only component name. While this is doable, I think it would significantly increase the complexity of some already pretty complicated code. This might have a performance impact. It would definitely have a maintenance impact.

Sebastian and I did discuss this possibility earlier on in the project, but I'm not convinced at this point that it's the right trade off. (In other words, I don't think it's a feature people want often enough to justify the effort of writing and maintaining it.)

Thanks for sharing the request! I'm going to close it for now though since I don't think it's the right direction to take with the search feature. We can always re-open it later if new info surfaces.