-
Notifications
You must be signed in to change notification settings - Fork 27
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
Links to component class #5
Comments
Looks something changed in react and class resolving doesn't work (https://github.com/lahmatiy/component-inspector/blob/master/src/react/inspector/template-info/index.js#L73) |
0.14.0-rc1 |
Ok. I'll check it. Coming back to work on it later this week. Fixing issues as well. |
I checked on 0.14.0-rc1 – it's works as expected. No link to class it means no meta information was attached to class. |
I'm using es6 classes. Also I'm using a lot of component decorators. Some of my components have 4 or 5 higher order components on them attached via decorators. import React, {PropTypes} from 'react';
import testable from 'frontend/utils/testable';
@testable()
export default class SignInForm extends React.Component {
static propTypes = {
// ...
}
render() {
return (
<form>
{/* ... */}
</form>
);
}
} |
Still works to me :-/ Also you can find an universal version in |
Variant 1: Class found, render method found, problem in source code. export default class Test extends React.Component {
render() {
return <div>qwe</div>
}
} Variant 2: Class and render method are found, but they are referenced to wrapped class. Problem in source code still exists. function decorator(Component) {
return class Wrapper extends React.Component {
render() {
return <Component />
}
}
}
@decorator
export default class Test extends React.Component {
render() {
return <div>qwe</div>
}
} Variant 3 (decorator from node_modules): class not found. import {connect} from 'react-redux';
@connect()
export default class Test extends React.Component {
render() {
return <div>qwe</div>
}
} |
So, class not found because inspector looking for a wrapped class, but that wrapped class doesn't instrumented. |
Why source code contains html? I don't know. I'm using:
|
What about
It tries get original source by request to server. Requested file is showing in popup header ( I think we should find way to tell inspector to use bundle source (with its source map) if possible. |
Thank you for your helpful examples. |
Yes, you're right, it works after I configured file serving. But I don't like this.
It's common practice in React ecosystem. Those classes called Higher Order Components like higher order functions. |
As I realised general problem is caused using decorators (HOC actually).
Initial solution was designed for basis.js, where no bundle in dev mode. And module subsytem has source of any executed module, as evaluate it on fly.
Second one looks better. |
Problem is gone, but there are two more issues:
I agree. |
It seems we have a misunderstanding. Problem with HOC is not solved yet (but just disscused with colleagues how to fix it). And when it will be fixed, it does not need to instrumenting libraries (in most cases).
I'm going to implement new middleware for code fragment extracting. And one more that mix two middlewares (new one and |
Great news, I'll wait. |
Mostly done on decorators. It requires new version of babel plugin required (not published yet). Also new custom viewer for details was implemented. Believe you'll like it :) Some edge cases are left to fix. And I'm going to release it (and babel plugin for instrumenting). New express middlewares are coming next. It would be great if you able to try it on your code base until release. |
Looks like you forgot rebuild inspector. |
You're right. Fixed. |
Just notice component name on your screenshot: |
Thank you for feedback.
|
Is it possible to separate those components to different levels?
|
Fixed 4db0260 |
It's not clear to me. Do you really needs this?
I think it's noisy and not necessary. I want improve viewer for cases when wrapper adds extra makrup. But in simple cases virtual component is redundant. |
This is definitely better then |
Hi! |
done |
Thank you a lot! |
Now
component-inspector
shows me only component instance location:How to enable all features from this gif?
The text was updated successfully, but these errors were encountered: