react icon indicating copy to clipboard operation
react copied to clipboard

[React 19] Fiber is missing a debug information

Open scirill opened this issue 1 year ago • 1 comments

Summary

In React 18, Fiber exposed _debugSource

updateQueue null

In React 19 (19.0.0-rc-915b914b3a-20240515) this was changed to _debugInfo but the value is alway null

updateQueue null

scirill avatar May 16 '24 04:05 scirill

@sebmarkbage Hi, I see you made the changes in the related code. You mentioned in the commit that the change is only for the server rendering, but now any debug information is missing for the client rendering components. Thanks

scirill avatar May 16 '24 05:05 scirill

This seems to have been removed with https://github.com/facebook/react/issues/29092

kblauhut avatar May 18 '24 20:05 kblauhut

This was removed in https://github.com/facebook/react/pull/28265, see that PR for the reasoning.

The internal fiber structure is internal and will break between any release.

rickhanlonii avatar May 19 '24 01:05 rickhanlonii

@rickhanlonii thank you for your answer, I understand the Fiber structure can be changed, but this change also broke the way DevTools displays the source. The lazy approach getting the source returns different information.

Before this change, the source in DevTools pointed to the place that used the Component in the project source file.

Now it will point to the place that defines the component in the compiled output of the build tool.

For example, before, if I had this code:

src/Hello.tsx

1: function Hello() {

2:    return <Typography>Some text</Typography>

3: }

The source for Typography pointed to {fileName: "src/Hello.tsx", lineNumber: 2}

But now the DevTools point the source to one of the runtime chunk files of the build tool (I'm using Vite so it shows like this chunk-OITURYR5.js?v=29ba3b73:1389) And this information is absolutely pointless for the user for debug purposes. Because of this change #28351 , DevTools 5.2 version is now showing the wrong source even for React 18, Should I open a new issue for this? Thank you

scirill avatar May 19 '24 02:05 scirill

The change to the source is expected I think, but breaking 18 isn't. Yeah please file a issue specific for that cc @hoxyq

rickhanlonii avatar May 19 '24 02:05 rickhanlonii

DevTools 5.2 version is now showing the wrong source even for React 18

For the past few weeks I've heard from many people the same feedback on the source location stuff, that people actually want to see the JSX part and not the actual component declaration, which totally makes sense to me. We would need to change the UI in DevTools for it though, because we have different features relying on the same source information. I will follow-up in https://github.com/facebook/react/issues/29164.

hoxyq avatar May 20 '24 07:05 hoxyq