File tree 2 files changed +11
-14
lines changed
2 files changed +11
-14
lines changed Original file line number Diff line number Diff line change 12
12
" css" ,
13
13
" modules"
14
14
],
15
- "version" : " 4.0.3 " ,
15
+ "version" : " 4.0.4 " ,
16
16
"author" : {
17
17
"name" : " Gajus Kuizinas" ,
18
18
"email" : " gajus@gajus.com" ,
Original file line number Diff line number Diff line change @@ -15,37 +15,34 @@ import renderNothing from './renderNothing';
15
15
export default ( Component : Object , defaultStyles : Object , options : Object ) => {
16
16
const WrappedComponent = class extends Component {
17
17
render ( ) {
18
- let propsChanged ;
19
18
let styles ;
20
19
21
- propsChanged = false ;
20
+ const hasDefaultstyles = _ . isObject ( defaultStyles ) ;
22
21
23
- if ( this . props . styles ) {
24
- styles = this . props . styles ;
25
- } else if ( _ . isObject ( defaultStyles ) ) {
22
+ if ( this . props . styles || hasDefaultstyles ) {
26
23
const props = Object . assign ( { } , this . props ) ;
27
24
25
+ if ( this . props . styles ) {
26
+ styles = this . props . styles ;
27
+ } else if ( hasDefaultstyles ) {
28
+ styles = defaultStyles ;
29
+ delete this . props . styles ;
30
+ }
31
+
28
32
Object . defineProperty ( props , 'styles' , {
29
33
configurable : true ,
30
34
enumerable : false ,
31
- value : defaultStyles ,
35
+ value : styles ,
32
36
writable : false
33
37
} ) ;
34
38
35
39
this . props = props ;
36
-
37
- propsChanged = true ;
38
- styles = defaultStyles ;
39
40
} else {
40
41
styles = { } ;
41
42
}
42
43
43
44
const renderResult = super . render ( ) ;
44
45
45
- if ( propsChanged ) {
46
- delete this . props . styles ;
47
- }
48
-
49
46
if ( renderResult ) {
50
47
return linkClass ( renderResult , styles , options ) ;
51
48
}
You can’t perform that action at this time.
0 commit comments