glidejs / glide

A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more
https://glidejs.com
MIT License
7.29k stars 772 forks source link

Update the clones as well as the "normal" slides #662

Open IKIKN opened 1 year ago

IKIKN commented 1 year ago

Hi,

I'm using the library to display slides that are sometimes being updated (for instance, the text inside it is changed).

It works well, except with the clones that are not being updated (they still contain the "old" text), so when I go to the last slide, then directly to the first, the old slide (the clone actually) is briefly visible before the updated slide.

Is there a way to avoid this behaviour?

Thanks!

Uliana97 commented 10 months ago

Hi, we are having the same issue with carousel clones, the styling of the clone is different when I go from the last slide to the first, so it causes some weird content jumping when the original item is shown after..

Can anyone provide us with any information?

leopacciulli commented 5 months ago

@IKIKN @Uliana97 Fixed it by adding the destroy method of the Glide instance when unmount:

if (glideInstanceRef.current) {
   glideInstanceRef.current.destroy()
}