Comments (10)
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.
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.
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.
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.
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.
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.
If RDT switches back to using
inspectit should fix it.window.$rexposes the component type. So, if RDT executesinspect(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.
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.
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.
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)
- Bug: React 19 Uncaught TypeError: Do not know how to serialize a BigInt HOT 2
- 'Splitter' button is not accessible using keyboard in windows.
- [Compiler Bug]: MDX content isn’t handled by React compiler HOT 2
- [Compiler Bug]: False positive on closure var reassignment in useMemo store HOT 3
- Bug: View Transitions occasionally stall with default `onDefaultTransitionIndicator` HOT 3
- Bug: useEffect does not run twice due to remounting in strict mode and dev run HOT 1
- [DevTools Bug] Commit tree already contains fiber "1088". This is a bug in React DevTools.
- [Compiler Bug]: TanStack Form incompatibility HOT 2
- Bug:
- Bug: ℗ is escaped as text HOT 2
- Bug: state changes inside forwardRef change the props object reference HOT 1
- [Compiler Bug]: set-state-in-effect false negative whenever tagged template literals are present HOT 1
- Typo in comment: “untill” → “until” in ReactDOMRoot.js HOT 1
- Bug: useEffectEvent having different behaviors when used with memo and without memo HOT 2
- [Compiler Bug]: Compilation skipped, reason unclear HOT 1
- Bug: IntersectionObserver causing effect to run again even when dependencies don't change HOT 2
- Bug: Getting `Cannot access refs during render` error from event handler. HOT 5
- Bug:
- Bug: `eslint-plugin-react-hooks` - Broken resolution in `7.0.1` HOT 1
- [DevTools Bug] Cannot read properties of undefined (reading 'map') HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react.