@@ -40,6 +40,8 @@ export class InnerSlider extends React.Component {
4040 this . callbackTimers = [ ] ;
4141 this . clickable = true ;
4242 this . debouncedResize = null ;
43+ const ssrState = this . ssrInit ( ) ;
44+ this . state = { ...this . state , ...ssrState } ;
4345 }
4446 listRefHandler = ref => ( this . list = ref ) ;
4547 trackRefHandler = ref => ( this . track = ref ) ;
@@ -51,8 +53,7 @@ export class InnerSlider extends React.Component {
5153 this . list . style . height = getHeight ( elem ) + "px" ;
5254 }
5355 } ;
54- UNSAFE_componentWillMount = ( ) => {
55- this . ssrInit ( ) ;
56+ componentDidMount = ( ) => {
5657 this . props . onInit && this . props . onInit ( ) ;
5758 if ( this . props . lazyLoad ) {
5859 let slidesToLoad = getOnDemandLazySlides ( {
@@ -68,8 +69,6 @@ export class InnerSlider extends React.Component {
6869 }
6970 }
7071 }
71- } ;
72- componentDidMount = ( ) => {
7372 let spec = { listRef : this . list , trackRef : this . track , ...this . props } ;
7473 this . updateState ( spec , true , ( ) => {
7574 this . adaptHeight ( ) ;
@@ -264,10 +263,9 @@ export class InnerSlider extends React.Component {
264263 let currentWidth = `${ childrenWidths [ this . state . currentSlide ] } px` ;
265264 trackStyle . left = `calc(${ trackStyle . left } + (100% - ${ currentWidth } ) / 2 ) ` ;
266265 }
267- this . setState ( {
266+ return {
268267 trackStyle
269- } ) ;
270- return ;
268+ } ;
271269 }
272270 let childrenCount = React . Children . count ( this . props . children ) ;
273271 const spec = { ...this . props , ...this . state , slideCount : childrenCount } ;
@@ -286,10 +284,10 @@ export class InnerSlider extends React.Component {
286284 width : trackWidth + "%" ,
287285 left : trackLeft + "%"
288286 } ;
289- this . setState ( {
287+ return {
290288 slideWidth : slideWidth + "%" ,
291289 trackStyle : trackStyle
292- } ) ;
290+ } ;
293291 } ;
294292 checkImagesLoad = ( ) => {
295293 let images = this . list . querySelectorAll ( ".slick-slide img" ) ;
0 commit comments