@@ -40,6 +40,8 @@ export class InnerSlider extends React.Component {
40
40
this . callbackTimers = [ ] ;
41
41
this . clickable = true ;
42
42
this . debouncedResize = null ;
43
+ const ssrState = this . ssrInit ( ) ;
44
+ this . state = { ...this . state , ...ssrState } ;
43
45
}
44
46
listRefHandler = ref => ( this . list = ref ) ;
45
47
trackRefHandler = ref => ( this . track = ref ) ;
@@ -51,8 +53,7 @@ export class InnerSlider extends React.Component {
51
53
this . list . style . height = getHeight ( elem ) + "px" ;
52
54
}
53
55
} ;
54
- UNSAFE_componentWillMount = ( ) => {
55
- this . ssrInit ( ) ;
56
+ componentDidMount = ( ) => {
56
57
this . props . onInit && this . props . onInit ( ) ;
57
58
if ( this . props . lazyLoad ) {
58
59
let slidesToLoad = getOnDemandLazySlides ( {
@@ -68,8 +69,6 @@ export class InnerSlider extends React.Component {
68
69
}
69
70
}
70
71
}
71
- } ;
72
- componentDidMount = ( ) => {
73
72
let spec = { listRef : this . list , trackRef : this . track , ...this . props } ;
74
73
this . updateState ( spec , true , ( ) => {
75
74
this . adaptHeight ( ) ;
@@ -264,10 +263,9 @@ export class InnerSlider extends React.Component {
264
263
let currentWidth = `${ childrenWidths [ this . state . currentSlide ] } px` ;
265
264
trackStyle . left = `calc(${ trackStyle . left } + (100% - ${ currentWidth } ) / 2 ) ` ;
266
265
}
267
- this . setState ( {
266
+ return {
268
267
trackStyle
269
- } ) ;
270
- return ;
268
+ } ;
271
269
}
272
270
let childrenCount = React . Children . count ( this . props . children ) ;
273
271
const spec = { ...this . props , ...this . state , slideCount : childrenCount } ;
@@ -286,10 +284,10 @@ export class InnerSlider extends React.Component {
286
284
width : trackWidth + "%" ,
287
285
left : trackLeft + "%"
288
286
} ;
289
- this . setState ( {
287
+ return {
290
288
slideWidth : slideWidth + "%" ,
291
289
trackStyle : trackStyle
292
- } ) ;
290
+ } ;
293
291
} ;
294
292
checkImagesLoad = ( ) => {
295
293
let images = this . list . querySelectorAll ( ".slick-slide img" ) ;
0 commit comments