From 2c2fe3794e0a37d30d73cef33a4dfedfc6d1b387 Mon Sep 17 00:00:00 2001 From: lipoolock <42861634+lipoolock@users.noreply.github.com> Date: Wed, 20 Jan 2021 18:36:15 +0100 Subject: [PATCH] Need to enforce images list validation In some cases, for instance while running some tests via storyshot, we can get a blocker with this error message: `Error: Uncaught [TypeError: Cannot read property 'querySelectorAll' of undefined]` Adding `this.list &&` at the beginning of this test will avoid such of issues and let pass well the tests I would really appreciate that fix to be able to move forward from `0.25.2` of react-slick to the latest version Thanks --- src/inner-slider.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/inner-slider.js b/src/inner-slider.js index 3f1939d50..7cbdb27ad 100644 --- a/src/inner-slider.js +++ b/src/inner-slider.js @@ -304,7 +304,7 @@ export class InnerSlider extends React.Component { }; checkImagesLoad = () => { let images = - (this.list.querySelectorAll && + (this.list && this.list.querySelectorAll && this.list.querySelectorAll(".slick-slide img")) || []; let imagesCount = images.length,