Skip to content
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

RFC: ReactInstrumentation.debugTool.onSetHostNode(debugID, node) #6834

Closed
gaearon opened this issue May 22, 2016 · 2 comments
Closed

RFC: ReactInstrumentation.debugTool.onSetHostNode(debugID, node) #6834

gaearon opened this issue May 22, 2016 · 2 comments

Comments

@gaearon
Copy link
Collaborator

gaearon commented May 22, 2016

We will need a way to get host nodes in React DevTools with the new API. We currently get them by reaching into ReactDOMComponentTree directly but I propose to transition to using devtool API (#5306) for this so that other renderers can provide their own host nodes when they become available.

I propose that the renderer code would emit something like

if (__DEV__) {
  ReactInstrumentation.debugTool.onSetHostNode(inst._debugID, node)
}

when node becomes associated and

if (__DEV__) {
  ReactInstrumentation.debugTool.onSetHostNode(inst._debugID, null)
}

when it is deassociated.

For DOM renderer, it would happen here.

Then we would add getHostNode() to ReactComponentTreeDevtool that would handle onSetHostNode event.

Does this sound reasonable? Longer term it would make something like this possible in userland.

@jimfb
Copy link
Contributor

jimfb commented May 22, 2016

Sounds reasonable to me, but how are you going to fire it for SFCs when it becomes disassociated?

@gaearon
Copy link
Collaborator Author

gaearon commented May 22, 2016

It would only be called for DOM components. React DevTools would then use the ReactComponentTreeDevtool to establish the closest (DOM) component with a host node.

@gaearon gaearon closed this as completed Oct 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants