From c0379f4917e08bca0251a8a0ccea9cf9592f062f Mon Sep 17 00:00:00 2001 From: Adel ak <47484379+Adel-ak@users.noreply.github.com> Date: Mon, 28 Nov 2022 12:50:57 +0300 Subject: [PATCH] [@mantine/carousel] Carousel: fixed carousel indicator not changing when slidesToScroll value is changed (#3058) --- src/mantine-carousel/src/Carousel.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mantine-carousel/src/Carousel.tsx b/src/mantine-carousel/src/Carousel.tsx index c7713ea0d5d..8d97fb2f5ad 100644 --- a/src/mantine-carousel/src/Carousel.tsx +++ b/src/mantine-carousel/src/Carousel.tsx @@ -255,7 +255,7 @@ export const _Carousel = forwardRef((props, ref) } return undefined; - }, [embla]); + }, [embla, slidesToScroll]); useEffect(() => { if (embla) { @@ -265,7 +265,7 @@ export const _Carousel = forwardRef((props, ref) clamp(currentSelected, 0, Children.toArray(children).length - 1) ); } - }, [Children.toArray(children).length]); + }, [Children.toArray(children).length, slidesToScroll]); const canScrollPrev = embla?.canScrollPrev() || false; const canScrollNext = embla?.canScrollNext() || false;