Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

feature request: dont show Components with regards to arbitrary exclude list (basically, hide repetitive High-Order Components from the Tree) #604

Closed
iamstarkov opened this issue Apr 4, 2017 · 11 comments

Comments

@iamstarkov
Copy link

iamstarkov commented Apr 4, 2017

Based on #211.

It would be nice, to have a exclude list of components, which i dont want to see in my react tree.

Exclude list have to be configurable and persistent.

Exclude list: [/GetContext*/, /Jss*/]

Tree Before:

<ButtonGroup>
  <GetContext(Jss(Button))>
    <Jss(Button)>
      <Button>
        <span>one</span>
      <Button>
    <Jss(Button)>
  </GetContext(Jss(Button))>
  <GetContext(Jss(Button))>
    <Jss(Button)>
      <Button>
        <span>two</span>
      <Button>
    <Jss(Button)>
  </GetContext(Jss(Button))>
  <GetContext(Jss(Button))>
    <Jss(Button)>
      <Button>
        <span>three</span>
      <Button>
    <Jss(Button)>
  </GetContext(Jss(Button))>
<ButtonGroup>

Tree After:

<ButtonGroup>
  <Button>
    <span>one</span>
  <Button>
  <Button>
    <span>two</span>
  <Button>
  <Button>
    <span>three</span>
  <Button>
<ButtonGroup>
@iamstarkov iamstarkov changed the title feature request: hide arbitrary list of High-Order Components feature request: dont show Components with regards arbitrary exclude list (basically, hide repetitive High-Order Components from the Tree) Apr 4, 2017
@iamstarkov iamstarkov changed the title feature request: dont show Components with regards arbitrary exclude list (basically, hide repetitive High-Order Components from the Tree) feature request: dont show Components with regards to arbitrary exclude list (basically, hide repetitive High-Order Components from the Tree) Apr 4, 2017
@gaearon
Copy link
Contributor

gaearon commented Apr 19, 2017

Also see the discussion in #503.
I think @jaredly started working on a generic blacklisting solution but didn’t finish it (?)

Do you want to propose a mockup for how it would work?

@iamstarkov
Copy link
Author

@gaearon what do you mean by mockup?

@shriah
Copy link
Contributor

shriah commented May 16, 2017

screen shot 2017-05-16 at 10 31 45 am

Something like this should work for initial implementation right ? I tried to copy the blackboxing setting of Chrome. I modified the Preferences Panel to look more like chrome settings.

@drcmda
Copy link

drcmda commented Oct 13, 2017

@gaearon @iamstarkov is blacklisting really the way to go? Any random app will cause thousands of random hoc's. It would be pretty tough to create a blacklist and maintain them from project to project. Using something like ant-design for instance covers any element in triggers, wrappers, tooltips, animationlayers, etc. Then our own routes, connects, providers, error-boundaries on top and the result is something like this:

screen shot 2017-10-13 at 11 49 52

In the majority of all cases i do not look for container hocs, i find it therefore hard to use dev tools. I am faster with hot-reload and console.log(this.props) than finding back the component i would like to inspect in the tree.

If there'd be a easy-to-reach checkbox that eliminates all components that don't end up outputting a dom/target element, that would be super useful. A checkbox that eliminates node_module components would also be great.

@iamstarkov
Copy link
Author

iamstarkov commented Nov 29, 2017

is blacklisting really the way to go? Any random app will cause thousands of random hoc's. It would be pretty tough to create a blacklist and maintain them from project to project.

would be pretty tough to create a blacklist and maintain

@drcmda no, not really. its simple RegExp https://regexr.com/3h9ib /[\(*\)]{1}/gim for example

@Jessidhia
Copy link

Jessidhia commented Mar 9, 2018

How about a Symbol.for('react.devtools.hide') property that can be set on the constructor/SFC?

Your HOC generator functions can then set that property on the generated components.

EDIT: made a quick implementation at #997

@markerikson
Copy link

This is especially needed with the new React.createContext() API, as all uses of MyContext.Provider and MyContext.Consumer show up in the tree.

It would be particularly nice if there was a checkbox to hide all "built-in React plumbing" component types (context, async/strict mode, etc).

@develleoper
Copy link

develleoper commented Jun 5, 2019

Was excited to see this issue open, as it addresses one of my primary complaints with HOC's (and was exacerbated by recent switch to React.createContext), but it seems to have had no discussion in the last year. Has the conversation moved elsewhere, or is it just deprioritized / awaiting submissions?

EDIT: my apologies, I just noticed there is a lot more recent activity in issue 1076. feel free to disregard! 😅

@SavePointSam
Copy link

the new React DevTools just merged support for this (in regards to HOCs). You can also create custom filters based on RegExp patterns.

@develleoper
Copy link

Oh, that's awesome! I tried out the beta that was mentioned in the other issue, and it works great, but I'm excited to see all the new features in the full final release. 🙂

@bvaughn
Copy link
Contributor

bvaughn commented Aug 19, 2019

React DevTools has been rewritten and recently launched a new version 4 UI. The source code for this rewrite was done in a separate repository and now lives in the main React repo (github.com/facebook/react).

Because version 4 was a total rewrite, and all issues in this repository are related to the old version 3 of the extension, I am closing all issues in this repository. If you can still reproduce this issue, or believe this feature request is still relevant, please open a new issue in the React repo: https://github.com/facebook/react/issues/new?labels=Component:%20Developer%20Tools

@bvaughn bvaughn closed this as completed Aug 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants