svelte-splide icon indicating copy to clipboard operation
svelte-splide copied to clipboard

Unhandled Promise rejection: Cannot read properties of undefined (reading 'length')

Open Enes5519 opened this issue 1 year ago • 0 comments

Checks

  • [X] Not a duplicate.
  • [X] Not a question, feature request, or anything other than a bug report directly related to Svelte Splide. Use Discussions for these topics: https://github.com/Splidejs/splide/discussions

Version

0.2.9

Description

When I opened my console I saw the following error, although it was difficult to debug I found it. In the code snippet I posted below prevSlides is undefined, which is why we get the length error.

https://github.com/Splidejs/svelte-splide/blob/master/src/lib/components/Splide/Splide.svelte#L114

There is a situation where afterUpdate is also working while onMount is working. By the way, we have fixed slides.

Reproduction Link

No response

Steps to Reproduce

        hasTrack={false}
        aria-label="Önyüz Gösterimi Slaytı"
        options={{ pagination: false, rewind: false }}
      >
        <div class="slide-header">
          <div class="preview-text">Önyüz Gösterimi</div>
          <div class="splide__arrows">
            <Button class="splide__arrow--prev" size="small" kind="neutral" variant="tertiary" icon="arrow_left" />
            <Button class="splide__arrow--next" size="small" kind="neutral" variant="tertiary" icon="arrow_right" />
          </div>
        </div>

        <SplideTrack>
          {#each info.images as image}
            <SplideSlide>
              <AssetImage class="image" name={image} alt={info.title + " örneği"} />
            </SplideSlide>
          {/each}
        </SplideTrack>
      </Splide>```

`info.images` is guaranteed to be full.

### Expected Behaviour

In isEqualShallow, it is possible to check if undefined is received as an argument, or if the prevSlides variable is undefined, do not put it into the equal operation at all.

Enes5519 avatar Oct 31 '24 14:10 Enes5519