Skip to content

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

Open
@Enes5519

Description

@Enes5519

Checks

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions