-
Notifications
You must be signed in to change notification settings - Fork 45.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DevTools Components Hide components filter should hide the component it owns #29776
Comments
ricardo-reis-1970
added
the
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
label
Jun 6, 2024
eps1lon
added
Type: Enhancement
Component: Developer Tools
and removed
Status: Unconfirmed
A potential issue that we haven't yet confirmed as a bug
labels
Jun 6, 2024
eps1lon
changed the title
Bug: DevTools Components Hide components filter not hiding subcomponents
DevTools Components Hide components filter should hide the component it owns
Jun 6, 2024
Do you mean every child or only the children it explicitly renders e.g. function Period({ children }) {
// vvv hide this component when hiding `Period`
return <div>{children}</div>
// ^^^^^^^^ What about these components?
} |
So function Period({ children }) {
// vvv hide this if you filter out Period
return <div>{children}</div>
// ^^^^^^^^ Hide this as well when you filter out Period
} I don't think that's the right default here. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I go to the Components tab of the React DevTools, I have an option to hide components in:
In this I can hide a component based on its name. The issue is that among many others I have a component called
Period
that has a ton of components underneath it because it usesReact Datepicker
. I add a rule like:but all it hides is the entry for my component. I obviously expected to hide it together with all its descendants, but instead the very single line called
Period
vanishes from the tree, and now the tons of subcomponents (Datepicker, remember?) are all there as if hanging directly from thePeriod
's parent component.React version: 18.2.0
DevTools version: 5.2.0-1717ab0171
Steps To Reproduce
Settings > Components > Hide components where...
Link to code example:
My code is corporate and therefore cannot be shared. However, the description I gave and the steps to reproduce are quite unmistakable. This is not a circumstance bug on my code.
The current behavior
Currently, if I want to hide a component and all its descendants, I would need to add these one by one to the filters, which becomes highly impractical very soon.
Furthermore, in hiding components under the component I'm trying to hide, I might be hiding components elsewhere with the same name that I need not hide.
The expected behavior
I'm not sure what purpose this serves, but this is really not practical. There should at the very least be an option for physical filter and logical filter, where physical would be "every instance of this name" and logical would be "every instance of this name AND its descendants".
Other improvements would be selecting components to be collapsed by default (like filtering out, but with the option to see them).
Finally, not sure this is intended, but filtering is case insensitive. JavaScript is not.
The text was updated successfully, but these errors were encountered: