File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ class FlickityComponent extends Component {
3131 }
3232
3333 componentDidUpdate ( prevProps , prevState ) {
34+ if ( ! this . flkty ) return ;
3435 const {
3536 children,
3637 options : { draggable, initialIndex } ,
@@ -39,7 +40,6 @@ class FlickityComponent extends Component {
3940 } = this . props ;
4041 const { flickityReady } = this . state ;
4142 if ( reloadOnUpdate || ( ! prevState . flickityReady && flickityReady ) ) {
42- if ( ! this . flkty ) return ;
4343 const isActive = this . flkty . isActive ;
4444 this . flkty . deactivate ( ) ;
4545 this . flkty . selectedIndex = initialIndex || 0 ;
@@ -61,7 +61,7 @@ class FlickityComponent extends Component {
6161 }
6262
6363 async componentDidMount ( ) {
64- if ( ! canUseDOM ) return null ;
64+ if ( ! canUseDOM || ! this . carousel ) return null ;
6565 const Flickity = ( await import ( 'flickity' ) ) . default ;
6666 const { flickityRef, options } = this . props ;
6767 this . flkty = new Flickity ( this . carousel , options ) ;
You can’t perform that action at this time.
0 commit comments