-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Provide info about component tree to devtools #6549
Conversation
@gaearon updated the pull request. |
@gaearon updated the pull request. |
@gaearon updated the pull request. |
@gaearon updated the pull request. |
@gaearon updated the pull request. |
@gaearon updated the pull request. |
@gaearon updated the pull request. |
1 similar comment
@gaearon updated the pull request. |
@gaearon updated the pull request. |
@gaearon updated the pull request. |
@gaearon updated the pull request. |
@gaearon updated the pull request. |
@gaearon updated the pull request. |
@sebmarkbage I removed |
@gaearon updated the pull request. |
emitEvent('onSetDisplayName', debugID, displayName); | ||
}, | ||
onSetIsEmpty(debugID, isEmpty) { | ||
emitEvent('onSetIsEmpty', debugID, isEmpty); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this so the tree devtool would filter them out in getChildIDs
. Alternatively I can go back to the old approach:
- Make composite check for whether the rendered component is empty, and ignore it in
onSetChildren
- The tree devtool becomes unaware of parent-child association between composite and empty component so it can't clean it up on unmount easily
- We have to add the native container IDs back so it's cleaned up on native container unmount instead
It feels like what I have now is simpler in terms of logic (all cleanup paths are the same and are caused by unmounting) but I can bring back native container tracking if it is more desirable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. I'd prefer if we could get rid of exposing this limitation because my reconciler just won't output any nodes for something that is empty. So I won't have this concept nor this limitation.
So it is exposing an implementation detail.
The tree devtool becomes unaware of parent-child association between composite and empty component so it can't clean it up on unmount easily
You can also just not expose it at all to the debug tool. That way it won't need to be cleaned up. Empty components doesn't have children or anything at all that is exposed.
So all you have to do is ignore any call to the debug tool that passes an instance of something "empty".
@gaearon updated the pull request. |
@gaearon updated the pull request. |
Ping @sebmarkbage, I would like to get this in asap because I’m stacking other work on top of this. |
emitEvent('onSetIsEmpty', debugID, isEmpty); | ||
}, | ||
onSetChildren(debugID, childDebugIDs) { | ||
if (!isTopLevelWrapper(debugID)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this check to where you call .onSetChildren(...)
?
The reason I want these gone is that my new reconciler won't have any of these limitations but it still wants to target this same ReactDebugTool.
I'll accept to avoid rebase problems but would be good to avoid exposing |
I’ll see what I can do there. Thanks! |
Provide info about component tree to devtools (cherry picked from commit 76a4c46)
This is a work in progress that supersedes #6486 and #6488.
Unlike them, it doesn’t use an ID map and instead lets the core emit events as they happen.
(I should’ve started with this approach, it’s way simpler!)
I revert #6488 here because it is no longer necessary but can do this as a separate PR as well.
Things to do: