Coder Social home page Coder Social logo

Comments (10)

hoxyq avatar hoxyq commented on November 9, 2025 1

Thanks for reporting!

I don't have access to the sandbox you've shared.

Also, could you please upgrade to version 7 of the extension and see if it reproduces?

from react.

doggybootsy avatar doggybootsy commented on November 9, 2025 1

It works on functional components without states now

I made the sandbox public (I think). If you do this snippet in console below in the sandbox. The button will be disabled, but if you run it twice the button will no longer be disabled but you cannot view the source of it

function MyComponent(params) {
    return React.createElement("div", {}, "Hello World");
}

example(React.createElement(MyComponent));

from react.

hoxyq avatar hoxyq commented on November 9, 2025 1

It works on functional components without states now

Probably the other way around?

It is a known issue that React DevTools can't find source code of the components that don't have any props or hooks used. All other components should work, which is a majority.

In your sandbox, only 2 user-space components don't have a source code - Child and AsyncChild.

from react.

doggybootsy avatar doggybootsy commented on November 9, 2025 1

Oh, wait I didn't notice that Child and AsyncChild was going to the wrong area.

Would changing it back to how it was in that commit I mentioned before fix RDT failing to find sources?

from react.

hoxyq avatar hoxyq commented on November 9, 2025 1

Would changing it back to how it was in that commit I mentioned before fix RDT failing to find sources?

I don't think so.

The essence of the problem here is that there is no way for the browser extension to get a source location of the JavaScript function, which doesn't have any arguments. At least I am not aware of one, if it exists.

I have an idea of doing a lookup in page sources and trying to find fn.toString() contents in there, this could work.

from react.

doggybootsy avatar doggybootsy commented on November 9, 2025 1

If RDT switches back to using inspect it should fix it. window.$r exposes the component type. So, if RDT executes inspect(window.$r.type) we wouldn't need arguments/hooks or whatever.

from react.

hoxyq avatar hoxyq commented on November 9, 2025 1

If RDT switches back to using inspect it should fix it. window.$r exposes the component type. So, if RDT executes inspect(window.$r.type) we wouldn't need arguments/hooks or whatever.

Are we talking about the same thing? Calling inspect() will navigate to the sources panel. This already works an it does navigate to the source code if you click on <> icon on the top right of the inspected element panel.

The problem is that React DevTools can only ask Chrome to navigate to the file, but it can't fetch the location of it, like file name and line number, which could be displayed under "source" section at the inspected element panel. That's why this is not displayed for Child and AsyncChild components.

from react.

doggybootsy avatar doggybootsy commented on November 9, 2025 1

This already works an it does navigate to the source code if you click on <> icon on the top right of the inspected element panel.

This part is where it commonly fails.

I honestly didn't even know about the source section in the devtools page

from react.

hoxyq avatar hoxyq commented on November 9, 2025 1

This part is where it commonly fails.

Could you please share a reproducer where it fails? Or specify a component in your sandbox for which it fails.

from react.

doggybootsy avatar doggybootsy commented on November 9, 2025 1

This previous comment has RDT failing #34581 (comment)

And both Child and AsyncChild have issues too, instead of viewing the source of those component's it opens where they're created instead

from react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.