File tree Expand file tree Collapse file tree 2 files changed +11
-14
lines changed
Expand file tree Collapse file tree 2 files changed +11
-14
lines changed Original file line number Diff line number Diff line change 1212 " css" ,
1313 " modules"
1414 ],
15- "version" : " 4.0.3 " ,
15+ "version" : " 4.0.4 " ,
1616 "author" : {
1717 "name" : " Gajus Kuizinas" ,
1818 "email" : " gajus@gajus.com" ,
Original file line number Diff line number Diff line change @@ -15,37 +15,34 @@ import renderNothing from './renderNothing';
1515export default ( Component : Object , defaultStyles : Object , options : Object ) => {
1616 const WrappedComponent = class extends Component {
1717 render ( ) {
18- let propsChanged ;
1918 let styles ;
2019
21- propsChanged = false ;
20+ const hasDefaultstyles = _ . isObject ( defaultStyles ) ;
2221
23- if ( this . props . styles ) {
24- styles = this . props . styles ;
25- } else if ( _ . isObject ( defaultStyles ) ) {
22+ if ( this . props . styles || hasDefaultstyles ) {
2623 const props = Object . assign ( { } , this . props ) ;
2724
25+ if ( this . props . styles ) {
26+ styles = this . props . styles ;
27+ } else if ( hasDefaultstyles ) {
28+ styles = defaultStyles ;
29+ delete this . props . styles ;
30+ }
31+
2832 Object . defineProperty ( props , 'styles' , {
2933 configurable : true ,
3034 enumerable : false ,
31- value : defaultStyles ,
35+ value : styles ,
3236 writable : false
3337 } ) ;
3438
3539 this . props = props ;
36-
37- propsChanged = true ;
38- styles = defaultStyles ;
3940 } else {
4041 styles = { } ;
4142 }
4243
4344 const renderResult = super . render ( ) ;
4445
45- if ( propsChanged ) {
46- delete this . props . styles ;
47- }
48-
4946 if ( renderResult ) {
5047 return linkClass ( renderResult , styles , options ) ;
5148 }
You can’t perform that action at this time.
0 commit comments