Open abynim opened 2 years ago
If the initialPageIndex prop is set to anything over 0, while the Carousel's content renders the correct page, the Dots always show the first Dot as selected.
initialPageIndex
Looks like the currentPageIndex in the Carousel is not set on mount. https://github.com/vadimkorr/svelte-carousel/blob/main/src/components/Carousel/Carousel.svelte#L204
currentPageIndex
Setting the currentPageIndex to match initialPageIndex on mount seems to fix it, but I don't know if that is the appropriate solution!
// Carousel.svelte Line 204 methods.showPage(initialPageIndex, { animated: false }) currentPageIndex = initialPageIndex; // Added this line
If the
initialPageIndex
prop is set to anything over 0, while the Carousel's content renders the correct page, the Dots always show the first Dot as selected.Looks like the
currentPageIndex
in the Carousel is not set on mount. https://github.com/vadimkorr/svelte-carousel/blob/main/src/components/Carousel/Carousel.svelte#L204Setting the
currentPageIndex
to matchinitialPageIndex
on mount seems to fix it, but I don't know if that is the appropriate solution!