Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFR: Allow displaying debug information for reconcilers in DevTools #19891
Comments
|
I don't know what you mean by "custom debug information". Can you given an example of what DevTools looks like now (with your custom renderer) and what you'd like it to look like? |
|
I am working on a project where React is running in a JS container and translated into native Flutter widgets. For that, I have a React reconciler that sends incremental updates over a bridge to Flutter and updates the Flutter widget tree (a bit similar to RN). Now, I'd like to add some debug information, e.g. the Flutter widget ID to the React Instance that was created by the reconciler. Right now, I am using an ugly hack: export function Box(props: BoxProps) {
return React.createElement("Box", props);
}
debugSetupComponent(Box);
export function debugSetupComponent<P extends {}>(func: (props: P) => ReactElement<P>) {
Object.defineProperty(func, "defaultProps", {
get: () => {
return { __instance__: [undefined] };
},
});
}Basically, Now consider a simple createInstance: (type, props, _rootContainerInstance, _currentHostContext, _workInProgress) => {
const id = ... // assign some ID for the native instance
const instance = ... // setup the native instance
props["__instance__"][0] = id; // fill debug infoThis shows up like this in the React devtools: But, it would be much nicer if I wouldn't need the |
|
Thank you for the detailed response @derolf! That's an interesting intermediate solution you've come up with. As for your initial issue, I'd like to think more about the proposed But maybe we can talk about |
|
Well, any sort of |
|
Not sure I follow. |
|
Is your custom renderer somewhere that I could see it / try it, by chance? |
|
Sorry, that’s not possible (yet), it's developed in-house, but we're planning to open-source it. |



React allows to develop custom reconcilers. However, currently it is not possible to display custom debug information about the generated Instances in the react DevTools.
Therefore, I propose to introduce two functions into
HostConfig:They should return an object with custom debug information that would be shown in DevTools whenever an Instance-backed Component is highlighted.