-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Icon Builder] Add muiName to generated SvgIcons #4188
[Icon Builder] Add muiName to generated SvgIcons #4188
Conversation
@@ -47,6 +47,7 @@ | |||
"lodash.merge": "^4.3.5", | |||
"lodash.throttle": "^4.0.1", | |||
"react-addons-create-fragment": "^15.0.1", | |||
"react-addons-shallow-compare": "^15.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already have it in our utils
folder don't we?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oliviertassinari We are currently using it from recompose
: https://github.com/callemall/material-ui/blob/master/src/TextField/TextField.js#L4
But I think we should get rid of recompose
.... all we are using it for is pure()
which is an entire component instance just to wrap a component with:
class Pure extends Component {
shouldComponentUpdate(nextProps) {
return !shallowEqual(this.props, nextProps);
}
render() {}
}
Which should be done normally, it is very little code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@oliviertassinari It isn't needed - I had used that first, then removed it from the template, but not from package,json
. Done now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nathanmarks - the only component left using pure()
is Stepper
! 😆
Could you give us some context on the use case. In which situation do we need the |
The same as any other component that we need to tell it's type, but specifically for |
I'm having some doubt about this statement. Why can't we add |
Yeah, you're right it was late, I misremembered the code refactor dependancy order. I switched to class to nix However if we add And if it's possible to add |
Isn't the purpose of composition? I don't see the win with this change of pure implementation. |
But they aren't classes. :)
|
@@ -56,6 +57,10 @@ class SvgIcon extends Component { | |||
hovered: false, | |||
}; | |||
|
|||
shouldComponentUpdate = (nextProps, nextState) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that we should implement a shouldComponentUpdate
for any component that accepts a children
property. The check will almost always fail unless users are caching their children manually or with babel-plugin-transform-react-constant-elements
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or we could tell users to use this babel plugin in production and to parse material-ui and we should be good 😁.
@oliviertassinari thanks for highlighting the main feature I overlooked in this use case. |
I thought I saw you change
Is this a typo or did I miss the documentation changes to icon-builder ? |
@vrtxf That's an old issue. The path should be |
sure |
AddingmuiName
necessitated switching to class syntax to supportshouldComponentUpdate
Edit: Removedpure()
from the template, and addedshouldComponentUpdate
toSvgIcon
.After some discussion, just added
muiName
to the existing template, and updated the build script comments andpackage.json
script.